error.code — error.message is human-readable and may change without notice.
The error envelope
Every error shares the same shape:request_id — it is the key for support and for retrieving the corresponding audit record.
Error categories
The codes fall into five categories. Each maps to an HTTP status range and a clear handling rule:Retry guidance
Theerror.retryable boolean tells you whether a retry can ever succeed without changing the request:
- Retry
429and5xxerrors. Prefererror.details.retry_after_seconds(or theRetry-Afterheader) when present; otherwise use exponential backoff with a ceiling. - Do not retry
400,401,403, and422— they require a change to the request, the credential, or the org’s configuration. Retrying an identical request will fail identically.
error events rather than HTTP status codes — handle both paths.
Full reference
This page is the platform-level overview. The complete code table — every code, its exact HTTP status, theerror.details fields it carries, and a worked retry loop — lives in the AI API error reference:
AI API Error Reference
The authoritative, exhaustive list of error codes and handling patterns, including streaming errors.