Walkthrough
1. Fix before retrying
Correct invalid input and resolve permission failures before trying again.
2. Retry transient faults carefully
Respect Retry-After when present. Use bounded exponential backoff with jitter and retry writes only when they are replay-safe.
3. Trace the request
Use the request ID in structured logs and look for the first failing dependency.
Worked example
A 409 tells the client the submitted operation conflicts with current state. In this inventory example, show fresh availability before asking the customer to try again.
| Code | Meaning | Next step |
|---|---|---|
400 | Malformed request | Check the body and content type. |
401 | Missing or invalid credentials | Authenticate again; do not retry unchanged. |
403 | Access denied | Check role, scope and ownership. |
404 | Resource not found | Check the route or identifier. |
405 | Method not allowed | Check the Allow header and use a supported method. |
409 | State conflict | Refresh state and review the conflicting operation. |
415 | Unsupported media type | Send a supported Content-Type. |
422 | Content cannot be processed | Correct the invalid fields. |
429 | Too many requests | Slow down and honor Retry-After when provided. |
500 | Unexpected server failure | Record the request ID; retry only if safe. |
502 | Bad gateway | Check the upstream dependency. |
503 | Temporarily unavailable | Check service health and honor Retry-After if supplied. |
504 | Gateway timeout | Reconcile the result before replaying a write. |
{
"type": "https://example.com/problems/out-of-stock",
"title": "Item unavailable",
"status": 409,
"detail": "The requested quantity is no longer available.",
"requestId": "req_demo_123"
}Show another code example
if (response.status === 409) {
await refreshAvailability();
showMessage("Stock changed. Review the updated quantity.");
}Reference: RFC 9457: Problem Details for HTTP APIs.