BLACK FRIDAYUntil Dec 8 (Tue) 23:59 JSTUntil Dec 8

Docs400 Input too long

400 The request could not be processed (input too long)

Causes and fixes for the HTTP 400 that Echo Token Station's API returns when the input is longer than the model's context length. With some models the message is only "The request could not be processed. Please check the request and try again.", which does not say that length is the cause.

This error is returned when the input (including the conversation so far and attached documents) is longer than the number of tokens the model can handle at once (its context length). With some models, the message does not show that length is the cause.

Example

400invalid_request_error (error.type in the OpenAI format), error.code is null

This is the response (OpenAI format) when about 306,000 characters of input were sent to qwen3-32b.

JSON
{"error":{"message":"The request could not be processed. Please check the request and try again.","type":"invalid_request_error","param":"","code":null}}

With other models, the upstream API's wording may be passed through as it is (for example prompt is too long: 250000 tokens > 200000 maximum).

Common causes

  1. The conversation got long: chat apps and agents send the whole conversation so far every time
  2. You put a large document or file content into the input
  3. The tool assumes a longer context length than the model has: Claude Code assumes a provisional context length for model IDs it does not know, and sends the conversation up to that length

When the request body is larger than 128 MB, you get a different error (Invalid request: request body exceeds 128 MB: request body too large).

How to fix

  1. Check the context length of the model you use on its model page in the model list
  2. Reduce the input: remove old turns, split documents, include only the parts you need
  3. Switch to a model with a longer context length
  4. If you use a model other than Claude in Claude Code, set the environment variable CLAUDE_CODE_MAX_CONTEXT_TOKENS to the context length on the model page, in tokens
bash
export CLAUDE_CODE_MAX_CONTEXT_TOKENS="<context length on the model page>"