Skip to content
TroubleshootingError codes

Error codes

Error format, codes and what to send to support.

Every API error arrives in one format: a machine error.code, a next step in error.action, the request id request_id (also in the request-id header) and a [code · req_…] tail at the end of error.message itself. The message text is in Russian; the code and the tail are language-neutral. The tail alone is enough for support @Guard_AI_support: it identifies the status, the code and the failing spot. Do not send the full key, the prompt or the answer.

Error format

The envelope depends on the endpoint; the error object inside is the same. /v1/messages and count_tokens answer in the Anthropic shape:

json
{
  "type": "error",
  "error": {
    "type": "billing_error",
    "message": "На API-ключе закончился баланс. Пополните ключ в @subscribe_ai_bot и повторите запрос. [insufficient_credit · req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718]",
    "code": "insufficient_credit",
    "param": null,
    "action": "Пополните ключ в @subscribe_ai_bot либо уменьшите максимальный размер ответа."
  },
  "request_id": "req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718"
}

/v1/chat/completions and /v1/responses answer in the OpenAI shape without the outer type:

json
{
  "error": {
    "message": "На API-ключе закончился баланс. Пополните ключ в @subscribe_ai_bot и повторите запрос. [insufficient_credit · req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718]",
    "type": "billing_error",
    "param": null,
    "code": "insufficient_credit",
    "action": "Пополните ключ в @subscribe_ai_bot либо уменьшите максимальный размер ответа."
  },
  "request_id": "req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718"
}

Authentication, Usage API and Files API errors put the same object under detail.error (authentication also mirrors it under error). Read error; if it is absent, read detail.error.

FieldWhat it holds
messagethe human text (Russian); it ends with the [code · request_id] tail
codea stable machine code: branch on it and quote it to support
typethe error class in Anthropic/OpenAI terms: invalid_request_error, authentication_error, rate_limit_error, api_error, etc.
paramthe field name when the error is about one field, otherwise null
actionone next step in plain words
request_idthe request id req_…; the same value is in the request-id header (for Kimi on Chat/Responses also in x-request-id)

Errors inside a stream

If the failure happens after the SSE stream started, the HTTP status is already 200 and the error arrives as a frame with the same object: an event: error on /v1/messages and /v1/responses, a data: {"error": …} frame followed by data: [DONE] on /v1/chat/completions. The connection is never dropped without a frame, including Kimi, Composer and Grok.

text
event: error
data: {"type": "error", "error": {"type": "api_error", "message": "Kimi временно недоступен. Повторите запрос через несколько секунд. [kimi_unavailable · req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718]", "code": "kimi_unavailable", "param": null, "action": "Повторите запрос позже; если ошибка сохраняется, обратитесь в поддержку."}, "request_id": "req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718"}

# on /v1/chat/completions the same object arrives as
data: {"error": {...}, "request_id": "req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718"}

data: [DONE]

HTTP statuses

CodeMeaningWhat to do
400Bad request (body/params)Read error.code and param; check the JSON, the model name, required fields (max_tokens for Anthropic).
401Missing, invalid or revoked keyCheck the key; issue a new one in the bot.
402Credit exhausted or insufficient for the reserveTop up the active key or lower max_tokens.
403Operation unavailable for the key or clientRead error.code and the selected API limits; topping up does not resolve every 403.
404Endpoint or model not foundCheck the endpoint (/v1/messages, /v1/chat/completions, /v1/responses) and the model id.
413The request body is too largeReduce the text, attachments or number of messages.
422Parameters failed validation (usage, files)Fix the field named in param.
429Rate/capacity or spend capRead error.code and Retry-After: change a spend cap in the bot; retry temporary limits after a delay.
500 / 502Internal failure or an invalid provider responseRetry; if it persists, send the [code · req_…] tail to support.
503Service temporarily unavailableRetry with exponential backoff; do not change the model blindly.
504The service did not finish in timeRetry; for long responses use streaming.

error.code values common to every family

error.codeStatusMeaningWhat to do
missing_api_key401no key was sentsend Authorization: Bearer gd-… or x-api-key
invalid_api_key401the key is unknown or copied incompletelycopy the key from the bot again
api_key_revoked, api_key_expired401 / 403the key was revoked or expiredissue a new key in the bot
api_key_suspended429the key is temporarily frozen by a safety rulewait for the time in Retry-After
insufficient_credit402the key's credit is exhaustedtop up the key in the bot
request_reserve_exceeds_credit402the remaining credit does not cover this request's maximum costlower max_tokens or top up
daily_spend_limit, hourly_spend_limit, daily_reserve_limit, hourly_reserve_limit429your own spend cap on the keychange the cap in the bot or wait for the window in Retry-After
invalid_json, invalid_body_type400the body is not JSON or not an objectfix the request body
invalid_request, unsupported_parameter, invalid_parameter400a field is invalid or unsupported on this surface; the name is in paramremove or fix the field
messages_required, model_required400a required field is missingadd the field
model_not_found404no such model in the cataloguetake an id from GET /v1/models
route_not_found, method_not_allowed404 / 405no such path or methodcheck the endpoint and method
request_body_too_large413the body exceeds the limitreduce the text or attachments
context_length_exceeded400the request does not fit the model's context windowshorten the history or pick a model with a larger window
product_modes_removed410Product modes are removed; an obsolete mode filter was sentRemove mode from the Usage API request
cyber_refusal400 / stream errorClaude returned a structured cybersecurity refusalChange the wording or contact support
client_key_rate_limit, client_ip_rate_limit429too frequent from one key or addressretry after Retry-After
service_capacity_saturated, standard_capacity_saturated429all service slots are busyretry after Retry-After
service_unavailable, upstream_unavailable503the service or provider is temporarily downretry with exponential backoff
stream_service_error, stream_timeoutin the streama failure after the stream startedretry; reduce the context on retry
internal_error500an internal service failuresend the [code · req_…] tail to support
usage_rate_limit, invalid_cursor429 / 400Usage reads are too frequent or the cursor is invalidSee Usage API

Kimi codes, including files, search and the seven reasons for 429, live on Kimi · Errors and retry. Composer and Grok codes follow.

Composer and Grok codes

Composer/Grok have their own error.code values. A new request rejected locally before contacting the model is not billed. An error during an existing tool loop or stream can concern work already executed and billed; check request history.

error.codeStatusWhat it means
cursor_parameter_unavailable400the body carries a field outside the short accepted list
cursor_client_tools_unavailable400the Responses input carries a provider-hosted tool item — web_search_call, file_search_call, computer_call and the like
cursor_client_tools_invalid400a bad tool declaration: more than 64 of them, a duplicate or invalid name, a schema over 256 KiB
cursor_client_tool_result_invalid, cursor_client_tool_result_too_large, cursor_client_tool_result_unsupported400the tool result is malformed, over 8 MiB, or in an unsupported shape
cursor_image_input_unavailable400an image was sent to Composer, which does not take them
cursor_image_input_invalid400the picture is not inline base64, has an unsupported type, or there are more than 16
model_not_found404the id is misspelled
request_reserve_exceeds_credit402the key balance does not cover the reserve for this request
cursor_daily_spend_limit, cursor_hourly_spend_limit, cursor_daily_reserve_limit, cursor_hourly_reserve_limit429your own spend limit; Retry-After carries the window length
client_key_rate_limit429too frequent; retry after a short pause
cursor_key_pause_limit429The key has reached its unfinished-tool-loop limit. Finish an existing loop; retrying alone will not help.
cursor_model_mismatchin streama different model answered upstream; arrives as a separate error event
cursor_unavailable503temporary unavailability; retry with exponential backoff
cursor_run_timeout504, an error event in a streamthe run did not finish within 600 seconds and was cancelled. The run is paid for
cursor_output_limit_exceeded502 for non-streaming repliesThe whole loop exceeded its output limit; executed work is billed. Streaming retains text and ends with max_tokens / length / response.incomplete.
cursor_upstream_error502, an error event in a streamthe run did not complete upstream. If the answer had already started, it is paid for

What to send to support

  • The [code · req_…] tail from the message text or the request_id value — a screenshot is enough.
  • Endpoint, model, stream true/false and the time with its zone.
  • No full key, prompt or model answer.

Documentation sections

On this page