Errors

Errors use the OpenAI error envelope, so OpenAI SDKs raise their normal typed exceptions.

Error shape

json
{
  "error": {
    "message": "Thread does not exist.",
    "type": "invalid_request_error",
    "param": null,
    "code": "thread_not_found"
  }
}

Common errors

HTTPtype / codeWhen
400invalid_request_errorMalformed JSON, missing messages/variables, bad UUID, malformed attachment, invalid timezone, malformed base64 image, or an ended thread.
401unauthorizedMissing or invalid API key.
404model_not_foundThe API key's app does not support this endpoint (e.g. calling /runs with an AI Chatbot app key).
404thread_not_foundThe thread_id does not exist (or belongs to another user).
404message_not_foundThe message_id passed to /messages/{id}/suggestions does not exist.
403suggestions_disabledFollow-up suggestions are switched off for this agent.
429rate_limit_exceededToo many concurrent requests for the app.
429insufficient_quotaThe model provider's quota is exhausted.
500provider_not_initializedNo model provider credentials are configured for the app.
500server_errorModel invocation failed or an unexpected internal error occurred.

Errors mid-stream

Once a stream has started the HTTP status is already 200, so a failure arrives as a final error event followed by data: [DONE]:

text
data: {"error":{"message":"Generation failed.","type":"server_error","param":null,"code":null}}

data: [DONE]

Handle both places

Check for an error key on stream events as well as non-2xx responses — a request can validate fine and still fail during generation.