Errors use the Anthropic error envelope:
  • error.type decides the HTTP status. Branch on it for the general case.
  • error.code is a stable, machine-readable reason. Branch on it for a specific one. The list below grows over time: treat a code you do not know like any other error of its type.
  • error.message is for people; do not parse it.
  • Quote request_id when you contact support.
  • A 409 carries x-should-retry: true only when retrying the same request can succeed (for example an Idempotency-Key still being processed).
A row marked retry means the same request may succeed later without changes; retry with exponential backoff. Rows without it fail again until you change the request or the state.

invalid_request_error (HTTP 400)

The request is malformed or not acceptable. What to do (unless a row says otherwise): Correct the request as the message describes and send it again; the same request will keep failing.

authentication_error (HTTP 401)

The credential is missing, wrong or expired. What to do (unless a row says otherwise): Send a valid credential (API key, access token or console session) and retry.

permission_error (HTTP 403)

The credential is valid but may not do this. What to do (unless a row says otherwise): Use a credential with the required role or access; retrying with the same credential will not help.

not_found_error (HTTP 404)

The addressed resource does not exist (or is not visible to the caller). What to do (unless a row says otherwise): Check the ID and the organization or workspace it belongs to; do not retry the same request.

conflict_error (HTTP 409)

The request conflicts with the current state of a resource. What to do (unless a row says otherwise): Re-read the resource, resolve the conflicting state, then send the request again.

request_too_large (HTTP 413)

The request exceeds the size limit. What to do (unless a row says otherwise): Delete older machine backups or raise the limit, then retry.

rate_limit_error (HTTP 429)

Too many requests or attempts. What to do (unless a row says otherwise): Wait for the Retry-After interval (or back off exponentially) and retry.

api_error (HTTP 500)

An error on the platform side. What to do (unless a row says otherwise): Retry with exponential backoff; the dependency is temporarily unavailable.

timeout_error (HTTP 504)

An upstream or machine did not answer in time. What to do (unless a row says otherwise): Retry with exponential backoff; the operation may have continued, so read the resource first.

overloaded_error (HTTP 529)

The platform or a dependency is temporarily overloaded. What to do (unless a row says otherwise): Retry with exponential backoff.