Troubleshooting
Common issues and solutions when using chowbea-axios.
This guide covers common issues you might encounter and how to resolve them.
Common Issues
Types Seem Stale
Symptom: Your generated types don't match the current API.
Solution: Delete the cache and regenerate:
# Delete the _internal folder to reset cache
rm -rf app/services/api/_internal
# Fetch fresh spec and regenerate
chowbea-axios fetch --forceMissing operationId Warning
Symptom: You see warnings like "Skipping operation without operationId".
Solution: This means some endpoints in your OpenAPI spec don't have operationId defined. While the path-based API will still work, operation-based methods won't be generated for these endpoints.
Run the validate command to see all issues:
chowbea-axios validateAsk your API team to add operationId to all operations in the spec.
Network Errors During Fetch
Symptom: Fetch fails with network errors.
Possible causes:
- API server is not running
- Incorrect endpoint URL
- Authentication required
Solution:
- Check your API server is running:
curl http://localhost:3000/docs/swagger/json- Verify the endpoint in your config:
chowbea-axios status- If authentication is required, add headers:
[fetch]
headers = { Authorization = "Bearer $API_TOKEN" }The CLI retries 3 times with exponential backoff. If all retries fail and you have a cached spec, it will use that instead.
Scripts Missing from package.json
Symptom: The api:* scripts aren't in your package.json.
Solution: Re-run init to add them:
chowbea-axios initOr add them manually:
{
"scripts": {
"api:fetch": "chowbea-axios fetch",
"api:generate": "chowbea-axios generate",
"api:watch": "chowbea-axios watch",
"api:status": "chowbea-axios status",
"api:validate": "chowbea-axios validate",
"api:diff": "chowbea-axios diff"
}
}Auth Headers Not Working
Symptom: Fetch fails with 401/403 even though headers are configured.
Solution: Check environment variable interpolation:
- Ensure the env var is set:
echo $API_TOKEN- Verify your config syntax:
[fetch]
# Both formats work:
headers = { Authorization = "Bearer $API_TOKEN" }
headers = { Authorization = "Bearer ${API_TOKEN}" }- Export the variable before running:
export API_TOKEN="your-token"
chowbea-axios fetchGeneration Failed with openapi-typescript Error
Symptom: Error mentioning openapi-typescript during generation.
Solution: The CLI uses pnpm dlx openapi-typescript internally. Make sure:
- You have pnpm installed (or npm/npx available)
- Your OpenAPI spec is valid JSON/YAML
Validate your spec first:
chowbea-axios validate --strictTypeScript Errors in Generated Files
Symptom: TypeScript compiler errors in _generated/ files.
Possible causes:
- OpenAPI spec has invalid schemas
- Circular references in spec
- Incompatible TypeScript version
Solution:
- Validate the spec:
chowbea-axios validate --strict- Regenerate with force:
chowbea-axios fetch --force- Check TypeScript version (5.x recommended)
Error Messages Reference
Config Errors
| Error | Cause | Solution |
|---|---|---|
CONFIG_ERROR | Config file missing or unreadable | Run chowbea-axios init |
CONFIG_VALIDATION_ERROR | Invalid config value | Check the specific field mentioned |
Network Errors
| Error | Cause | Solution |
|---|---|---|
NETWORK_ERROR | Cannot reach API endpoint | Check server is running, verify URL |
HTTP 401 | Authentication required | Add auth headers to config |
HTTP 404 | Endpoint not found | Verify api_endpoint URL |
HTTP 5xx | Server error | Check API server logs |
Spec Errors
| Error | Cause | Solution |
|---|---|---|
SPEC_NOT_FOUND | No cached spec | Run chowbea-axios fetch first |
SPEC_PARSE_ERROR | Invalid JSON/YAML | Run chowbea-axios fetch --force |
Generation Errors
| Error | Cause | Solution |
|---|---|---|
GENERATION_ERROR | openapi-typescript failed | Validate spec, check TypeScript |
OUTPUT_ERROR | Cannot write files | Check folder permissions |
Getting Help
If you're still stuck:
- Run with verbose output:
chowbea-axios fetch --verbose- Check the status of your setup:
chowbea-axios status- Validate your OpenAPI spec:
chowbea-axios validate --strict- Open an issue on GitHub with:
- The error message
- Your
api.config.toml(remove sensitive headers) - Your OpenAPI spec (or a minimal reproduction)