An overloaded_error from the Anthropic API means the upstream service is at capacity, typically returning with a 529 status code, so retry with exponential backoff; at https://api.uplinkswitch.com/v1 the gateway handles automatic retries and failover to alternative routes when configured. It is a capacity signal, never a verdict on your account, your quota or your prompt. What trips people up is that the type and the HTTP status are two separate fields, and code that checks only one of them misses the cases where they part ways.
Error type versus HTTP status
The status is on the HTTP response line. The error type is a string inside the JSON body, at error.type. Anthropic pairs each status with a type, and for overload the pair is 529 with overloaded_error, but the body is what names the problem. Anthropic's errors reference documents the envelope and the type for each status, not a fixed message, so the sketch below shows the documented shape with placeholders:
{
"type": "error",
"error": {
"type": "overloaded_error",
"message": "<human-readable description>"
},
"request_id": "<request id>"
}There are at least three situations where you meet overloaded_error and the status is something else, or nothing at all.
| Where you see it | HTTP status | Where overloaded_error sits |
|---|---|---|
| A non-streamed call straight to Anthropic | 529 | error.type in the body |
| A stream that had already started | 200, already sent | event: error in the stream |
| A Messages call through this gateway, every route busy | 503 | error.type in the body, code upstream_unavailable |
| The same call when the last route tried failed outright | 502 | Not present: the type is api_error, code upstream_error |
Inside a stream
Anthropic's streaming reference notes that errors can arrive in the event stream after a 200, and gives overload as the example, describing it as what would normally be a 529 outside a stream:
event: error
data: {"type": "error", "error": {"type": "overloaded_error", "message": "Overloaded"}}Per those docs, no status code will ever tell you about this one; the 200 went out before the overload happened. Your stream handler has to treat an error event as the failure of the whole request, discard the partial text, and start again.
Through the gateway
Here the gateway absorbs the overload first. A route that answers overloaded is skipped for the model's next route, and then for each id in your models fallback list, provided no byte has reached you yet. When all of them are busy, the refusal is a 503 with the code upstream_unavailable, printed in parentheses at the end of the message, and a retry-after header; in Anthropic's format its type reads overloaded_error. Nothing is charged for it. If the last route tried fails outright instead, the 502 carries api_error, the type Anthropic's reference gives an unexpected internal error, with the code upstream_error. Match on error.type or on the code in parentheses, not on the status alone, and retry both.
Branch on the body, not just the number
In the Anthropic Python SDK, every non-2xx answer raises an APIStatusError subclass that carries status_code and the raw response. Read the error type from the response body so one branch covers a direct 529 and a gateway 503 alike:
import anthropic
client = anthropic.Anthropic(
api_key="sk-uplink-live-...",
base_url="https://api.uplinkswitch.com/v1",
)
try:
msg = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=256,
messages=[{"role": "user", "content": "Name three uses for a queue."}],
)
except anthropic.APIStatusError as e:
try:
err_type = e.response.json().get("error", {}).get("type")
except ValueError:
err_type = None
if err_type in ("overloaded_error", "api_error"):
print("busy, retry after", e.response.headers.get("retry-after"), "seconds")
else:
raiseclaude-sonnet-5-5 read ok on the 2026-11-23 catalog. An id that reads degraded is more likely to answer busy, so check the catalog before you blame the code.
Retry now, or wait?
Wait. The SDK's built-in retries already back off exponentially and honour retry-after, two attempts by default, raised with max_retries. If you retry by hand, sleep for the retry-after value when the response has one, double the wait each attempt when it does not, and cap the number of attempts. The 529 overloaded fix has a full retry loop and a server-side fallback list, so it is not repeated here.