CONTEXT / ERROR-CATALOG-v1
context_lengthcauses and resolution
Context, request body, or output budget exceeded
- context_length
- context_length_exceeded
- max_tokens_exceeded
What this signal means
The combined input, history, tool definitions, attachments, and reserved output exceed a limit.
Sanitized response example
{
"error": {
"code": "context_length_exceeded",
"message": "Maximum context length exceeded"
}
}Possible causes
- Conversation history, system instructions, or retrieved context is too long.
- Character-based client estimates disagree with the model tokenizer or reserved max_tokens.
Verification and resolution order
- 01
Record model ID, input tokens, reserved output, and tool-schema size.
- 02
Compress or chunk context and remove duplicate history or unused tool definitions.
- 03
Recalculate with the provider tokenizer and the model context window.
What this error cannot prove
Models, relays, and endpoints may count attachment and tool tokens differently.