This guide covers common issues you may encounter when generating OpenAPI documentation and provides actionable solutions.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/charlietyn/openapi-generator/llms.txt
Use this file to discover all available pages before exploring further.
Invalid API Type Parameter
Cause
The requested API type is either:- Not defined in
config/openapi.php - Disabled in the
api_typesconfiguration array - Misspelled in the command or query parameter
Solution
The legacy API type
movile is automatically converted to mobile, but you should update your code to use mobile directly.No Routes Found
Cause
Route filtering has excluded all routes. This can happen when:- API type filters remove all matching routes
- Route exclusion patterns are too broad
- No routes are registered with the specified API type
Solution
Review route exclusions
Review route exclusions
Check your Action: Remove or refine patterns that might be excluding routes you want to document.
config/openapi.php for overly aggressive exclusion patterns:Verify API type filters
Verify API type filters
If using Try without filters to see all routes:
--api-type, ensure your routes are tagged with that API type:Check route registration
Check route registration
Verify routes are actually registered:Look for routes that should be documented but might be missing the proper middleware or metadata.
HTTP 500 When Accessing Documentation Endpoint
Cause
Common causes include:- Invalid JSON in template files
- Syntax errors in custom templates
- Exceptions during route introspection
- Memory limits exceeded with large route sets
Solution
Run generation via CLI
The CLI provides full error output:This will show the complete stack trace and error message.
Validate JSON templates
Check all templates in Look for:
resources/openapi/templates/:- Missing commas
- Trailing commas
- Unclosed brackets
- Invalid placeholder syntax
Enable detailed logging
Set your app to debug mode temporarily:Then check
storage/logs/laravel.log for detailed errors.Placeholder Values Not Updating
Cause
Laravel’s config cache is enabled, and some values are read usingenv() at runtime instead of from cached config.
Solution
Prefer config over env()
Instead of changing
.env values, override config values in config/openapi.php:Best Practice: When using
config:cache in production, always set values in config files rather than relying on runtime env() calls.Concurrent Generation File Corruption
Cause
Multiple workers or processes runningopenapi:generate simultaneously write to the same output files.
Solution
Use unique output paths
Use unique output paths
When running generation jobs in parallel, specify unique output files:
Implement command locking
Implement command locking
Use Laravel’s command locking to prevent concurrent execution:
Use queue serialization
Use queue serialization
If running generation in queued jobs, use the
SerializesModels trait and ensure jobs run one at a time:Template JSON Parsing Failures
Cause
Invalid JSON syntax or missing template files inresources/openapi/templates/.
Solution
Verify template exists
Check that the template file exists:Required templates:
openapi.jsonpostman.jsoninsomnia.json
Validate JSON syntax
Use a JSON validator:Common issues:
- Trailing commas:
"key": "value",}❌ - Missing quotes:
{key: "value"}❌ - Unclosed brackets:
{"key": "value"❌
Large Route Sets Causing Timeouts
Cause
Generating documentation for hundreds of routes with complex FormRequest validation can exceed PHP execution time limits.Solution
Use CLI generation and serve static files
Use CLI generation and serve static files
Generate documentation offline and serve pre-built files:Then configure your web server to serve the static file instead of the HTTP endpoint.
Increase PHP execution time
Increase PHP execution time
For the HTTP endpoint, increase time limits:
Use API type filters
Use API type filters
Reduce the number of routes processed per request:
Optimize route exclusions
Optimize route exclusions
Exclude routes that don’t need documentation:
Rate Limiting or Auth Blocking Documentation Routes
Cause
The middleware stack for documentation routes includes authentication or rate limiting:Solution
Stale Cache in Long-Running Workers
Cause
The OpenAPI cache is enabled and has a long TTL, causing workers to serve outdated specs.Solution
Disable cache for queue jobs
Disable cache for queue jobs
Reduce cache TTL
Reduce cache TTL
Clear cache after deployments
Clear cache after deployments
Add cache clearing to your deployment script: