Skip to content
TroubleshootingError codes

Error codes

Error format, codes and what to send to support.

Model protocol

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_help: 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-ключе закончился баланс. Пополните ключ в @guardapi и повторите запрос. [insufficient_credit · req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718]",
    "code": "insufficient_credit",
    "param": null,
    "action": "Пополните ключ в @guardapi либо уменьшите максимальный размер ответа."
  },
  "request_id": "req_3f9a2c1e8b7d4e0fa1b2c3d4e5f60718"
}

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

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

GLM error shapes

Messages returns an Anthropic-compatible wrapper; Chat and Responses use an OpenAI-compatible wrapper. Branch on HTTP status and error.code, not localized message text.

json
{
  "error": {
    "message": "…",
    "type": "invalid_request_error",
    "code": "unsupported_media",
    "param": "messages"
  }
}
GroupCodes
Fix requestinvalid_json, invalid_request, invalid_parameter, unsupported_media, unsupported_parameter, unsupported_tool, model_not_found
Retry with delayclient_key_rate_limit, glm_queue_timeout, glm_rate_limit, glm_unavailable
Responses continuationresponse_not_found, response_account_unavailable
Malformed upstream responseglm_invalid_response, glm_invalid_stream, glm_count_unavailable

See GLM: errors and boundaries for the full action table, including the 10-second queue, Retry-After, media, and previous_response_id.

Gemini codes

Gemini errors use the same wrapper as the other families: branch on the HTTP status and error.code, not on the text. In Chat Completions and Responses error.param names the field when it is known; in Messages it is always null. A request refused before it reaches the model is not charged.

error.codeStatusMeaningWhat to do
invalid_json, invalid_request400the body is not JSON or a field is invalid, including a reasoning level the model does not have; the field name is in paramfix the request body
model_not_found404no such model in the catalogtake the id from GET /v1/models: gemini-4-argon or gemini-3.8-flash
gemini_parameter_unsupported400a field Gemini does not support; param names the object that holds it, and "request" for a top-level fieldremove the field
gemini_unsupported_content, gemini_media_unsupported400Gemini accepts text, images, and PDF; audio, video, and other files are not acceptedremove the attachment or send its content as text
gemini_invalid_media, gemini_inline_media_required400the attachment is invalid: the link is not https or contains a login, or the base64 is damaged; in Messages the source is neither base64 nor a link; an image link inside a tool resultsend the attachment as base64 or an open https link; inside a tool result, as base64
gemini_tool_result_media_unsupported400a tool result contains an attachment other than PNG, JPEG, WEBP, or PDFsend the result as text or in one of these formats
gemini_tool_unsupported400a tool other than functions and search, for example separate page loading web_fetchkeep functions and the built-in search
gemini_search_options_unsupported400a search setting Gemini does not have: a domain list, max_tool_calls, and other fieldskeep only type, name, and max_uses on the search tool
gemini_tool_choice_unsupported400a required call or a call of a specific function combined with search, or a required call without functionssplit the request or remove the required call
gemini_strict_tools_unsupported, gemini_parallel_limit_unsupported400strict: true on a function or a ban on parallel callsremove the field
invalid_tool_structure400duplicate function names, a tool_choice naming a function that is not in the list, call arguments that are not JSON, or a function call outside an assistant messagefix the function list or the call history
gemini_thinking_unsupported400a thinking form Gemini does not accept: budget_tokens, other thinking or reasoning fields, reasoning.summary other than "auto"use thinking: {"type": "adaptive"} and set the level with the level field from the model page
invalid_request with param: "background"400background Responses execution is not supportedremove background
gemini_history_required400Gemini does not accept the conversation fieldsend the history in input or continue with previous_response_id
gemini_history_mismatch, gemini_native_history_invalid, gemini_history_not_found400 / 404the history does not match the saved one, the saved history of a function call does not fit the request, or the response for previous_response_id was not found or is older than 30 dayssend the whole dialogue history
gemini_rejected400Gemini did not accept the requestcheck the request fields and the dialogue history
policy_refusal400Google refused the request or the answer under its own rules: a block, safety, or a match with protected text. This code comes only without streaming: a stream gets 502 gemini_invalid_stream before the answer starts and a gemini_stream_error frame afterrephrase the request
api_key_paused403the key or this family is paused in the key settingsresume the key or turn the family on in the key settings in your Guard account
insufficient_credit, request_reserve_exceeds_credit402the key balance is used up or does not cover the request reservetop up the key in the bot or lower max_tokens
client_key_rate_limit, gemini_rate_limited429too many requests from one key, or Gemini temporarily limited the request rateretry after Retry-After
gemini_quota_exhausted429the quota of this model is used upretry after the limit resets (time in Retry-After) or choose another model
gemini_unavailable, service_unavailable503no free account right now, or Gemini is temporarily unavailableretry with exponential backoff
gemini_not_connected503Gemini models are not connected yetretry later or choose a model of another family
gemini_settings_unavailable, gemini_billing_unavailable, gemini_history_unavailable503settings, accounting, or the history store is temporarily unavailableretry in a few seconds
gemini_invalid_response, gemini_invalid_stream, gemini_invalid_usage, gemini_incomplete_response, gemini_incomplete_stream, gemini_empty_response, gemini_generation_failed, gemini_unsupported_output, gemini_partial_function_call_unsupported, gemini_invalid_json_value, gemini_upstream_error502the Gemini response came incomplete or invalida new request is safe only if your application prevents duplicate side effects
gemini_stream_errorin the streamthe stream broke after the answer started. Internal failures parsing the Google stream (gemini_stream_event_too_large, gemini_stream_already_finished) arrive as this frame, and before the answer starts as 502 gemini_invalid_streamthe delivered part stays with the client; retry the request

Muse codes

Muse errors use the same wrapper as the other families: branch on the HTTP status and error.code, not on the text. In Chat Completions and Responses error.param names the field when it is known; in Messages it is always null. A request refused before it reaches the model is not charged.

error.codeStatusMeaningWhat to do
invalid_json, invalid_request400the body is not JSON, a field is invalid, or Meta refused the request parametersfix the request body
invalid_parameter, invalid_messages, invalid_input, invalid_stream, invalid_stream_options, invalid_tools, invalid_previous_response_id400a field value is invalid, for example the level none or a non-boolean store; the field name is in paramfix the field
unsupported_parameter400a field Muse does not support: a separate web_fetch, search domain limits, background Responses execution, token counting with previous_response_idremove the field; for counting, send the history in input
unsupported_media400Muse accepts text, images, and PDF; video, audio, and other files are not acceptedremove the attachment or send its content as text
unsupported_tool400provider-side MCP tools are not available through Guardremove the tool or run it as a client function
model_not_found404no such model in the catalogtake the id from GET /v1/models
response_not_found404this key has no response for previous_response_id, or it was created with store: falsesend the history in input
response_account_unavailable409the continuation is temporarily unavailable on the account that stores the responseretry later or send the history in input
api_key_paused403the key or this family is paused in the key settingsresume the key or turn the family on in the key settings in your Guard account
insufficient_credit, request_reserve_exceeds_credit402the key balance is used up or does not cover the request reservetop up the key in the bot or lower max_tokens
client_key_rate_limit, muse_rate_limit, muse_queue_timeout429too many requests from one key, or all Muse slots are busyretry after Retry-After
muse_unavailable, muse_pool_unavailable503Muse is temporarily unavailableretry with exponential backoff
muse_not_connected503Muse models are not connected yetretry later or choose a model of another family
muse_prompt_unavailable, muse_state_unavailable, muse_billing_unavailable503settings, response state, or accounting is temporarily unavailableretry in a few seconds
muse_prompt_model_invalid503an applied Muse setting contains an invalid request changedo not loop the same request; send the code to support
muse_invalid_response, muse_invalid_stream502the Meta response came incompletea new request is safe only if your application prevents duplicate side effects
muse_stream_errorin the streamthe stream broke after the answer startedthe delivered part stays with the client; retry the request

Sections

On this page