Scenario

A 400 for long answers

L1ScreenIncident15 minScreenDebugging

RolesLLM Product EngineeringCustomer AI DeploymentInference Engineering

Engine
vLLM 0.31.0
Model
Qwen/Qwen3-0.6B
Hardware
the shared second L4 of a two-GPU node, with another user's processes on it

Situation

A product team runs Qwen/Qwen3-0.6B on one vLLM server for an internal writing tool. A support ticket arrives: "the API rejects long answers". The client sets max_tokens to 50000 so that the model never cuts an answer short, and every such request comes back as HTTP 400 at once, before any token streams. Shorter requests work.

The ticket asks the platform team to "turn off the limit". You pick it up with the error body, the startup log of the server and the manual.

Questions

  1. Read the error body. Which two numbers does it compare, and which parameter does it name?
  2. Where does the server get the second number, and what does it have to do with the KV pool?
  3. The ticket asks to turn off the limit. What are the two honest fixes, and who makes each change?
  4. A second ticket reports the same status code, but the message names the prompt length. What is different, and what is the fix?

Commit to a cause after each listing. Write it down before you read the next one.

Evidence

1/5

the answer the client got

Read the two numbers in the message and the parameter that it names.

evidence/the-error.txt
== c44 max_tokens above max model len
HTTP/1.1 400 Bad Request
{"error":{"message":"max_tokens=50000 cannot be greater than max_model_len=40960. Please request fewer output tokens. (parameter=max_tokens, value=50000)","type":"BadRequestError","param":"max_tokens","code":400}}

Source: manuals/vllm-101/capture/gpu/out-l4/livecheck-2026-10-22.txt, lines 46-48

2/5

the pool and the maximum length of that server at startup

The second line gives the longest request the server accepts and how many such requests fit in the pool.

evidence/the-pool-at-startup.txt
(EngineCore pid=2813854) INFO 10-22 21:25:26 [gpu_worker.py:692] Available KV cache memory: 9.02 GiB
(EngineCore pid=2813854) INFO 10-22 21:25:26 [kv_cache_utils.py:2464] GPU KV cache size: 84,480 tokens, Maximum concurrency for 40,960 tokens per request: 2.06x

Source: manuals/vllm-101/capture/gpu/out-l4/livecheck-2026-10-22.txt, lines 11-12

3/5

a request that the server cut at its own cap

With max_tokens of 64 the finish reason is length, and the reasoning field holds the start of the answer.

evidence/a-cut-answer.txt
== c03 thinking on, 64 tokens
finish length
content None
reasoning "\nOkay, the user asked me to name three prime numbers. Let me think. First, what's a prime number? A prime number is a nu"

Source: manuals/vllm-101/capture/gpu/out-l4/livecheck-2026-10-22.txt, lines 19-22

4/5

the troubleshooting entry for this status code

Two shapes of the same error, and the fix for each side.

evidence/the-troubleshooting-entry.txt
### A request returns HTTP 400 about the maximum context length

- **Cause:** the prompt tokens plus `max_tokens` are more than `--max-model-len`.
- **Check:** the error says `This model's maximum context length is` and gives the counts. When `max_tokens` alone is above the limit, the error says that `max_tokens` cannot be greater than `max_model_len`, as it did on our L4.
- **Fix:** send a shorter prompt or a smaller `max_tokens`, or start the server with a larger maximum length if the pool allows it.

Source: manuals/vllm-101/sections/7-1-troubleshoot-by-symptom.md, lines 99-103

5/5

the four choices when the pool holds too few users

The first choice is the one that this ticket is about.

evidence/four-ways-to-fit-more.txt
## Decide what to change

If the count is too small for your traffic, you have four choices. They are in order of cost:

1. Lower `--max-model-len` to the longest context that your users send. The pool stays the same size, and one long request can no longer take all of it.
2. Use an FP8 KV cache. It halves the bytes per token. [The FP8 KV page](#s-fit-more-users-with-an-fp8-kv-cache) shows the cost.
3. Use FP8 weights. They free memory for the cache. [The FP8 weights page](#s-fit-a-bigger-model-with-fp8-weights) shows when this pays.
4. Use a GPU with more memory, or split the model across GPUs. [The parallelism page](#s-choose-tensor-pipeline-or-data-parallelism) covers this.

Source: manuals/vllm-101/sections/2-1-count-the-memory-before-you-pick-a-gpu.md, lines 83-90

The answer

Show the walkthrough
  1. Read the body. The message says that max_tokens=50000 cannot be greater than max_model_len=40960, and the param field names max_tokens. The server checks the numbers of a request before it schedules anything, so the 400 arrives at once and no token is generated. The client asked for more output than one request may hold.
  2. Read the startup lines. The server derived a longest request of 40,960 tokens from the model config, and it sized its pool at 84,480 tokens from 9.02 GiB of KV cache memory. The second line says that 2.06 requests at the full length fit at once. The maximum length is a budget for one request, and the pool is the budget for everyone. A request for 50,000 output tokens would exceed the first budget on an empty server.
  3. Read what a cut answer looks like. In the same check session a request with max_tokens of 64 ran, and the server stopped it with the finish reason length. That is how a client learns that an answer was cut: the stream ends with length instead of stop. A huge max_tokens is not the way to avoid a cut; the finish reason is the way to see one.
  4. Read the two shapes of the error. The troubleshooting entry gives both. When the prompt tokens plus max_tokens exceed the limit, the message names the model's maximum context length and gives the counts. When max_tokens alone is above the limit, the message is the one in this ticket. The fix is the same pair in both cases: a shorter prompt or a smaller max_tokens on the client, or a larger maximum length on the server if the pool allows it.
  5. Read the order of server-side choices. The manual lists four moves when the pool holds too few users, in order of cost, and the first is to lower the maximum length to the longest context that users send. The direction of this ticket is the opposite: raising the limit lets one request take a larger share of the pool. The startup line already said that about two full-length requests fit. A larger limit means fewer users at full length, so it is a measured decision, not a ticket closure.
Show the resolution

The limit is a budget, not a bug. The client asked for 50,000 output tokens on a server whose longest request is 40,960 tokens, and the server refused before any work. The client fix is a max_tokens that the product needs, far below the limit, and a check of the finish reason so that a cut answer is visible to the user. That is what the 64-token check shows: the server reports length when it cuts.

The server fix exists, and it is conditional. Raise --max-model-len only after you measured the longest prompt plus answer that users send, and only if one request at that length still fits the pool next to the other users. On a pool of 84,480 tokens, each step up in the limit lowers the count of full-length requests that fit, from the 2.06 of the startup line. The startup check enforces the same rule from the other side: a server whose one full-length request does not fit refuses to start, as the shared-GPU start in the manual did at 2,928 tokens when only 2,912 fit.

Show the wrong turns
  • “Turn off the limit on the server.”

    The maximum length is the KV cache that one request may take, and the pool sizes it. Without it one request can claim most of the pool and starve every other user.

  • “Set max_tokens to exactly the limit.”

    Then the prompt plus the answer exceeds the context, and the server returns the other shape of the same 400, the one that names the prompt tokens.

  • “Raise the maximum length until the ticket stops.”

    A longer limit means fewer requests fit at once. Measure the longest real request first, and check that it fits the pool.

  • “Retry the request.”

    A 400 is a check on the numbers in the request, and the same request gets the same answer.

Show the general rule

A 400 from a model server is usually a budget that the operator set on purpose. Read the two numbers in the message, find which side owns each one, and change the side that is wrong: the client's request, or the server's measured limit. Never remove a limit to close a ticket, and teach clients to read the finish reason instead of asking for an unbounded answer.

Taught in

The vLLM manual lists this status code in the troubleshooting page, orders the server-side choices in the memory counting page and shows the same budget at startup in the out-of-memory page.