API Error Code Database
Structured reference of common API errors with causes, fixes, and curl examples. Built for AI agents and developers.
Rate Limit Exceeded
Too many requests in a short period. OpenAI enforces RPM (requests per minute) and TPM (tokens per minute) limits.
Implement exponential backoff. Start with 1s delay, double each retry up to 60s. Check response header `x-ratelimit-reset-requests` for reset time.
curl https://api.openai.com/v1/chat/completions -H "Authorization: Bearer $KEY" -d '{"model":"gpt-4o","messages":[{"role":"user","content":"hi"}]}'Invalid Authentication
API key is missing, expired, or invalid. The Authorization header format is wrong.
Verify Bearer token in header. Check key at platform.openai.com/api-keys. Regenerate if compromised.
curl https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"
Service Unavailable
OpenAI servers are overloaded or under maintenance. Temporary outage.
Retry with backoff. Monitor status.openai.com for incidents. Consider fallback to another provider (Anthropic, Gemini).
Internal Server Error
Unexpected server-side error. Usually transient.
Retry request. If persists >5 min, check status page. Log the request ID from response headers for support.
Bad Request
Malformed request body. Invalid JSON, missing required fields, or parameter out of range.
Validate JSON structure. Check max_tokens is within model limits. Ensure messages array is not empty.
Rate Limited
Exceeded requests per minute. Anthropic has tiered rate limits.
Backoff with retry-after header value. Upgrade tier at console.anthropic.com for higher limits.
Overloaded
Anthropic servers at capacity. Temporary overload condition.
Wait and retry. This is Anthropic's equivalent of 503. Exponential backoff recommended.
Permission Denied
API key lacks permission for the requested model or region.
Enable the API in Google Cloud Console. Check the model name is correct. Verify billing is set up.
Resource Exhausted
Quota exceeded. Free tier has strict limits.
Check quota at console.cloud.google.com/apis. Wait for quota reset or upgrade to paid tier.
Insufficient Balance
Account balance is zero or negative. Prepaid credits exhausted.
Top up at platform.deepseek.com. Check usage dashboard for consumption rate.
Too Many Requests
Exceeded Stripe API rate limit (100/sec in test mode, 25/sec in live).
Use idempotency keys for retries. Implement exponential backoff. Batch operations where possible.
Bad Credentials
Token is expired, revoked, or lacks required scopes.
Generate new token at github.com/settings/tokens. Check required scopes in API docs.
Resource Not Accessible
Token has insufficient permissions for this resource.
Add required scopes to token. Check organization access settings.
Rate Limited
Exceeded Vercel API rate limit (varies by plan).
Check x-ratelimit-remaining header. Backoff 1-60s. Upgrade plan for higher limits.
Database Unavailable
Project is paused (free tier) or database is restarting.
Go to app.supabase.com and unpause project. Wait for restart to complete (~30s).