You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provider API: opaque 400 "Request validation failed." (no param) on long tool-heavy sessions, DeepSeek lane #1163
Note the message is a JSON string nested inside the message field — so the client sees an error whose text is another JSON document, with "code":"400" (not the usual param-bearing body). There is nothing for the caller to act on: no field path, no trace id, no documented limit to compare against.
Impact
A single session becomes permanently unusable: the client rebuilds the same history on every retry, so every subsequent turn fails the same way. Users have to abandon the conversation and start a new one.
Evidence
Captured the exact request body that fails (tcpdump on the loopback hop of our gateway, body reassembled and replayed):
model: deepseek/deepseek-v4.1-flash
body: 3.7–3.9 MB
messages: ~220 (1 system / 52–59 user / 124–196 assistant / 119–191 tool)
8–9 image_url parts (real PNG/JPEG data URLs, in user messages)
every assistant message carries reasoning_content
The same body is accepted by the DeepSeek official API (200), and by another account in the same pool, so the payload itself is well-formed. Only the Command Code lane rejects it — and only for sessions of this size; smaller requests with the same tools/model return 200.
What we already ruled out (all return 200 on CC)
duplicate function.name in tools (CC rejects this, but with a different error)
tool_choice pointing at an unknown tool (also a different error)
max_tokens 8k → 128k
single message bodies up to 5 MB, and up to ~400k tokens of real text
images up to 7.6 MB as data URLs, including inside tool messages
reasoning_content on user / assistant / tool / system messages, and as array (array is rejected with a param, string is fine)
null-valued fields: parallel_tool_calls, tool_choice, max_tokens, temperature, top_p — these all produce a usefulparam error, which is what we'd expect here too
Ask
Is there a documented limit on request body size / token count / message count for /chat/completions? If yes, which one, and can the error become explicit (param or code) instead of Request validation failed.?
If the nested "code":"400" string is coming from an upstream lane rather than your validator, can that be surfaced distinctly?
Any chance of a trace/request id in the 400 body? We can supply full request bodies (privacy-scrubbed) plus timestamps if it helps.
Activity