AI API errors: diagnose requests, limits, and model access

A source-dated AI API error reference covering OpenAI, Claude and Gemini: request validation, account limits, resource access and recovery.

By benchr Editorial Team · · · Changelog

Start with the provider, endpoint, HTTP status, and structured error field. A shared status does not imply a shared fix: a 429 can mean temporary traffic pressure, an exhausted daily allowance, or an enforced spend cap. The records below identify the documented scope and the date its source was read.

Showing 16 of 16 errors

Google permission_denied

HTTP 403 · access control

Trace a Gemini permission failure through the deployed credential, project, restrictions and exact resource without blindly rotating keys.

Also covers: PERMISSION_DENIED

Documentation read

OpenAI insufficient_quota

HTTP 429 · quota billing

Distinguish depleted credits, enforced project or organization spend limits, and approved usage limits before retrying an OpenAI 429.

Also covers: credit_balance_exhausted, organization_spend_limit_exceeded, project_spend_limit_exceeded, organization_usage_limit_exceeded

Documentation read

OpenAI rate_limit_exceeded

HTTP 429 / 503 · rate limit

Separate temporary OpenAI rate limits from billing failures, inspect retry headers, and bound retries without multiplying SDK attempts.

Also covers: slow_down, server_is_overloaded

Documentation read

OpenAI context_length_exceeded

HTTP 400 · context

Diagnose separate input, output and combined context limits, count the complete request, and distinguish HTTP validation from failed agent turns.

Documentation read

OpenAI model_not_found

HTTP 404 · model availability

Check the exact OpenAI ID, endpoint, account scope and lifecycle notice without treating a 404 as proof that an entire family retired.

Documentation read

OpenAI invalid_api_key

HTTP 401 · authentication

Trace an OpenAI 401 through the deployed secret, organization, project and IP controls without logging key values or fragments.

Documentation read

Anthropic overloaded_error

HTTP 529 · server overload

Handle Claude 529 overload with bounded retries or deferral, preserve partial streams, and keep request IDs without inventing availability results.

Documentation read

Anthropic rate_limit_error

HTTP 429 / 400 · rate limit

Distinguish Claude traffic limits from monthly spend caps, inspect structured details, and account for workspace, cache and SDK behavior.

Also covers: enforced_spend_limit_reached

Documentation read

Anthropic invalid_request_error

HTTP 400 · request format

Inspect Claude request validation, configured spend limits, thinking contracts, prefill restrictions and model-specific sampling controls.

Documentation read

Anthropic request_too_large

HTTP 413 · context

Match Claude byte limits to the endpoint, measure real JSON serialization, and avoid treating file or batch allowances as model context capacity.

Documentation read

Anthropic not_found_error

HTTP 404 · model availability

Identify the missing Claude resource, check deployment scope, and use exact retired IDs with current provider-recommended replacements.

Documentation read

Google RESOURCE_EXHAUSTED

HTTP 429 / 402 · rate limit

Distinguish Gemini rate, daily and spend limits from depleted Prepay credit, using the correct Interactions or GenerateContent error fields.

Also covers: rate_limit_exceeded, quota_exceeded, too_many_requests, payment_required

Documentation read

Google INVALID_ARGUMENT

HTTP 400 · request format

Parse the correct Gemini error envelope, isolate invalid fields, and remove obsolete sampling controls according to the model documentation.

Also covers: invalid_request, parameter_unknown, API_KEY_INVALID

Documentation read

Google NOT_FOUND

HTTP 404 · model availability

Identify the missing Gemini resource and distinguish expired references, alias routing, restricted access and exact model retirement notices.

Also covers: not_found, model_not_found

Documentation read

Google DEADLINE_EXCEEDED

HTTP 504 · server overload

Distinguish Gemini provider deadlines from local timeouts, preserve partial output, and bound retries without assuming work stopped.

Also covers: deadline_exceeded

Documentation read

Google FAILED_PRECONDITION

HTTP 400 · quota billing

Investigate the exact Gemini prerequisite, distinguish regional free-tier access from billing and quota failures, and authorize spending separately.

Also covers: FAILED_PRECONDITION

Documentation read

Which part of the operation failed?

An HTTP request can be rejected before work starts. A stream can fail after HTTP 200, and an asynchronous task can fail after it has been accepted. Record those outcomes separately; an accepted request is not a completed model result.

For Gemini, the Interactions error reference uses a string error.code and delivers streaming errors as events. The GenerateContent reference, which Google labels legacy, uses a numeric error.code plus an uppercase error.status. Keep the actual interface in your diagnostic record instead of applying one parser to both.

Decide whether waiting can help

For a documented temporary rate limit or overload, honor available retry guidance and bound both attempts and elapsed time. For depleted credits, an enforced cap, missing permission, an unavailable resource, or an invalid request, inspect the specific cause before resending. SDKs can have automatic retries of their own; account for those attempts in the application policy.

Anthropic documents a monthly tier-spend cap that also returns rate_limit_error, with error.details.error_code set to enforced_spend_limit_reached on Messages. OpenAI distinguishes prepaid balance, configured organization/project hard limits, and its assigned usage limit through specific codes. Google's GenerateContent reference distinguishes HTTP 402 depleted Prepay credits from HTTP 429 rate or spend pressure. Those differences are covered in the provider-specific records.

Match a missing model to an exact lifecycle record

A 404 is not proof that an entire model family retired. Compare the complete ID, endpoint, account scope, and effective date with the retirement record. It preserves scheduled, completed, earliest-possible, and withdrawn notices. A source-backed schedule is still different from a live probe of your deployment.

Capture a useful incident record

  • Provider, API host, endpoint or operation, and API/SDK version.
  • Exact model or resource ID, account scope, HTTP status, and structured error code or type.
  • Request ID, relevant retry and limit headers, attempt count, and elapsed time.
  • Whether output was absent, partial, complete, or followed by a stream/task failure.

Redact credentials, prompts, document contents, and personal data. Diagnostic priority is benchr's editorial ordering for triage, not a measured outage frequency or a provider severity rating. Documentation dates establish source review, not a successful API run.

Changelog

  • 2026-10-15 — Reconstructed the diagnostic index and connected every linked record, alias, source date and metadata description to the canonical error ledger. Removed stale lifecycle claims and universal retry advice.
  • — Corrected the Gemini 2.5 lifecycle guidance after re-reading Google's current table; added the confirmed Gemini Omni Flash Preview deadline.
  • — Added Gemini permission_denied (403), covering the documented distinction between authentication and permission to use a resource.
  • — Section launched with 15 errors across OpenAI, Anthropic, and Gemini, each verified against official provider documentation.

Sources and documentation review

Documentation review dates are recorded per source. No provider inference or independent benchmark replication was performed for this revision.

  1. OpenAI error codes — read
  2. Claude API errors — read
  3. Claude spend and rate limits — read
  4. Gemini Interactions API errors — read
  5. Legacy GenerateContent API errors — read