Internalize / Docs
API reference

Errors and retry decisions

Distinguish rejected requests, failed jobs, and outcomes that need reconciliation.

View as Markdown

An HTTP error means the current API request did not return a successful response. A job error describes an admitted operation. They are related but not interchangeable: a successful GET /v1/jobs/{id} can return a job whose status is failed.

HTTP error envelope

{
  "error": {
    "code": "insufficient_credits",
    "retryable": false,
    "request_id": "HTTP_REQUEST_ID"
  }
}

The request ID is also returned in X-Request-Id. Preserve it with the method, route, status, and timestamp. Avoid logging authorization headers or model content to diagnose an error.

Error reference

HTTPCodeMeaning and next action
401unauthorizedMissing, malformed, expired, or revoked key. Check the server credential.
403server_keys_onlyThe request carries an Origin header. Move the API call to your server.
403insufficient_scopeThe key lacks the operation's scope. Use the correct credential.
403preview_onlyHosted model admission is disabled. Retrying cannot enable execution.
402insufficient_creditsAvailable balance cannot cover the reservation. Fund the project when live billing is enabled.
402spend_limit_exceededCurrent spend plus reservations would exceed the hard monthly limit. Review Settings.
402project_frozenThe balance needs reconciliation, for example after a refund. Resolve billing.
403tenant_scope_mismatchThe request selects a tenant outside the key’s fixed restriction. Use the authorized tenant or correct server credential.
404not_foundUnknown route or resource, or resource outside the key's project. Verify the ID and project.
409idempotency_conflictThe same key was used for different work. Recover the original payload or choose a new key for a genuinely new operation.
409activation_conflictThe expected active version no longer matches. Read current state and make a release decision.
409adapter_expiredRequired adapter retention has expired. Inspect the route and contact support.
413body_too_largeJSON body exceeds the byte limit. Reduce the request.
422invalid_requestInvalid JSON, content type, header, field, or semantic constraint. Check the endpoint schema.
429rate_limitedNew admission limit reached. Honor Retry-After and back off.
503platform_not_configuredA required platform dependency is unavailable or unconfigured. Retry reads conservatively; preserve write identity.
500internal_errorAn unexpected server error occurred. Keep the request ID and recover writes idempotently.

Console-specific operations can also report invalid_origin or billing_not_configured. They are not reasons to change public API key scopes or bypass the console's session boundary.

What retryable means

The public HTTP wrapper marks rate_limited, platform_not_configured, and internal_error as retryable. That flag describes whether a later transport attempt might succeed. It does not authorize a new idempotency key, prove the original work never started, or cancel a job.

A non-retryable admission error can become resolvable after a deliberate change. For example, adding real credit can resolve insufficient_credits. If no job was admitted and the intended body is unchanged, reuse its original idempotency key after fixing the cause.

For reads, use bounded exponential backoff with jitter. For model writes, retry only the same intent with the same key and body. Set a ceiling on attempts so a configuration failure does not become an endless loop.

Job errors

A job's error contains code and retryable; its ID already identifies the durable operation. Worker codes can indicate curriculum failure, teacher validation failure, expired state, dispatch uncertainty, or provider execution problems. Treat the code as diagnostic and inspect status and settlement before deciding what to do.

reconciliation_required needs investigation even if your client library throws an exception. Do not catch it in a generic retry loop that submits a new learning or inference job. Preserve the original ID and follow job recovery.

Unknown codes

Display a useful generic failure when a code is unrecognized, and preserve the code in restricted operational logs. Avoid branching on human-readable text or raw provider messages. The server intentionally returns bounded machine-readable errors rather than private provider detail.

Use safe diagnostics to report a reproducible problem without including keys, prompts, source passages, or answers.

On this page