Errors, rate limits and retries
For engineers
Classifying API errors, staying under rate limits, retrying with backoff, setting timeouts and falling back to other models
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
Your call returns HTTP 400 with an invalid_request_error body. What is the right response?
Check yourself · 2 of 5
A batch job sends short prompts but hits 429 even though it is far below its requests-per-minute limit. What is the most likely cause?
Check yourself · 3 of 5
What does adding jitter to a backoff schedule achieve?
Check yourself · 4 of 5
Why is a 5 second total timeout a poor choice for a call that generates a long report?
Check yourself · 5 of 5
Which error is the best trigger for switching to a backup model?
Topics
- Reading API error types and status codes5 min read · Invalid request, authentication, permission, payload too large, rate limit, server and overloaded errors, and which of them are worth retrying
- Staying under request and token rate limits5 min read · Requests and tokens per minute, usage tiers, rate-limit response headers and client-side throttling
- Retrying with exponential backoff and jitter5 min read · Honouring retry-after, capping attempts, adding jitter and not stacking your retries on top of the SDK's
- Setting timeouts for long model generations5 min read · Connect, read and total deadlines sized to output length, SDK defaults and streaming for long requests
- Falling back to another model or provider5 min read · Switching on overload or outage, keeping prompts compatible and checking the fallback still meets the output contract
Start here
- Errors (Claude API) (opens in a new tab)DocsFree
The status codes, error types and request-id header the Claude API returns, with the SDK exception classes.
- Rate limits (Claude API docs) (opens in a new tab)DocsFree
Requests and token limits per tier, the token bucket model and the anthropic-ratelimit response headers.
- Error codes (OpenAI API) (opens in a new tab)DocsFree
A second vendor's error list: which codes mean fix the request and which mean wait and retry.
Scenarios
Helps to know first
110 questions · last verified 2026-12