---
title: "Claude API returned 529 or 429? When to retry and when to fix"
description: "Claude API errors come in two kinds: temporary ones you retry after a wait, like 529, 500 and most 429s, and ones in the request itself that retrying will not fix, like 400 and 401. The official SDK retries twice on its own, and you decide the rest."
url: https://ihsanalapsi.dev/articles/claude-api-errors-retry
lang: en
date: 2026-11-14
updated: 2026-11-14
tags: ["AI", "Developer tools"]
author: Ihsan Alapsi (إحسان العبسي)
---
# Claude API returned 529 or 429? When to retry and when to fix

Your app uses the Claude API, and suddenly your logs show a 529, then a 429. The first reaction: "retry it." But some errors are fixed by a retry, and others just waste the user's time and repeat the same mistake. This article shows how to tell them apart, and how to let your code handle it.

## What does each Claude API error mean?

Every Claude API error has an HTTP status code and a type written in the response. The codes split into errors in the request itself and temporary errors on the API side.

According to [the Claude API errors page](https://platform.claude.com/docs/en/api/errors):


| Code | Type                    | What it means                                       | Retry?                   |
| ---- | ----------------------- | --------------------------------------------------- | ------------------------ |
| 400  | invalid\_request\_error | A problem with the format or content of the request | No, fix the request      |
| 401  | authentication\_error   | A problem with your API key                         | No                       |
| 403  | permission\_error       | The key lacks permission                            | No                       |
| 413  | request\_too\_large     | The request is over the size limit                  | No, make it smaller      |
| 429  | rate\_limit\_error      | Your organization hit a limit                       | Usually, after a wait    |
| 500  | api\_error              | An unexpected internal error                        | Yes, with a growing wait |
| 529  | overloaded\_error       | The API is temporarily overloaded                   | Yes, with a growing wait |


## When do you retry?

You retry when the error is temporary: 500, 529 and most 429s. And you retry with a wait that grows each time (exponential backoff), not instantly back to back.

The docs say it plainly for a 500: retry the request with exponential backoff, and if it persists, contact support with the request ID. And for a 529: it can occur when the API sees high traffic across all users.

## Why can you not retry every 429?

You cannot retry every 429, because the same code comes back when you hit a rate limit and when your organization reaches its monthly spend cap. The first clears after a while; the second does not.

The docs give you the sign: a spend-cap 429 has no retry-after header and keeps failing until access resumes. So if there is no retry-after and it keeps coming back, stop retrying and tell the account owner.

## What does the SDK do on its own?

The official SDK retries temporary failures on its own, such as connection errors, rate limits and 5xx errors, with exponential backoff, twice by default, honoring the retry-after header when present. You can change the count with max\_retries.

```python
import anthropic

client = anthropic.Anthropic(max_retries=4)

try:
    message = client.messages.create(
        model="claude-sonnet-5-5",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Hello, Claude"}],
    )
    print(message._request_id)
except anthropic.APIStatusError as e:
    log_error(e.status_code, e.message)
    raise
```

And when you write error handling, the docs advise catching the SDK's typed error classes, the most specific first, instead of matching the text of error messages.

## Why should you log the request-id?

You should log the request-id because it is the one thing that lets support find your exact request. Every API response includes a request-id header, and the same value appears as the request\_id field in error responses.

Log it with every error, next to the code and type. When a 500 keeps happening, you send support real request IDs instead of "something is broken."

## Where do you start now?

The lesson for you as a developer: you wait out a temporary error, you fix an error in the request, and you never mix the two.

1. Open the place where you call the Claude API, and check whether you retry every error the same way.
2. Let the SDK retry the temporary ones, and change max\_retries if you need to.
3. Stop retrying on 400, 401, 403 and 413, and on a 429 with no retry-after that keeps coming back.
4. Log the request-id with every error.

Another case where a reply stops halfway, with no error at all, is in [the stop\_reason and max\_tokens article](/articles/claude-stop-reason-max-tokens). All our AI articles are in [AI articles](/articles?tag=ai). And if you work with coding agents, there are ready [AI skills](/products/c/ai-skills) for Claude Code.

Right now, what does your code do when it gets a 529?

## FAQ

**What is the difference between 429 and 529?**

A 429 means your organization hit one of its limits, like a rate limit. A 529 means the API itself is temporarily overloaded, which can happen under high traffic across all users, not because of you.

**Should I raise the retry count a lot so nothing ever fails?**

No. Endless retries make the user wait longer and do not fix a lasting error like a monthly spend cap. Keep the count small, then show a clear message or put the request in a queue.

**The error came mid-stream after a 200. How do I handle it?**

That case is different. The docs say an error after a 200 response in streaming does not follow the standard HTTP error handling, and it has its own event shape on the streaming page.
