Study FAQ
How do I diagnose a Claude API failure and decide whether to retry?
Also asked as 2
- Which Claude API errors require a request change, and which can be retried?
- How can I distinguish rate limits, overload, stream errors, and bad model output in Claude?
Answer
Start with the last boundary that completed. Check request construction and connection, then API status or streaming events, then parser and consumer state. Evaluate model quality after a complete response reaches application validation.
| Evidence | Recovery |
|---|---|
| 400, 401, 402, 403, 404, or 413 | Read the error details. Correct invalid payloads, spending or billing problems, credentials or permissions, resource identifiers, or request size. Retrying the unchanged request is unlikely to help. |
| 409 conflict | Resolve the conflicting resource state before repeating a write. |
| 429 | Inspect the error code and quota scope. Honor retry-after when present. A tier spend-cap 429 has no retry delay and needs restored access. Traffic ramp limits and token or request rate limits need pacing. |
| 500-class fault, 529 overload, or a connection error | Retry within budget only when the operation can be safely repeated. Honor a refusal to retry in x-should-retry and any retry-after delay. An ambiguous timeout can mean the service already received work. |
| Error event after HTTP 200 or no terminal SSE event | Record an incomplete stream. Check the last valid event, remaining open blocks, timeouts, and consumer queue before choosing a recovery. |
| Complete Message with an invalid result | Inspect stop reason and failed application checks to separate truncation, invalid structure, and low-quality content. |
Record sanitized operation and attempt IDs, environment, model configuration, timing, status and error type, the request ID when available, and stream phase. Escalate persistent or deterministic failures to the owner of the failed boundary. Use a prequalified fallback only if it can satisfy the same requirements, and record which path returned the result.
Official references
Full explanation
Reliable Claude API Streaming, Asynchronous Work, and Error Handling
Study guide · CCDV-F
Read the full explanation