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
Title: opencode-go / deepseek-v4-flash: continuing a long session returns 400 with opaque body {"object":"error","model":"deepseek-v4-flash"} #48093
Long agent session (message tree, ~93k tokens context, cache read 90k) in a repo with many tool rounds.
After one assistant turn that made 3 tool calls, the next request (tool results → model) fails 400. Every subsequent retry in the same session fails identically; instant rejection (~2s, isRetryable: false).
Switching the same session to qwen3.8-flash (same provider) succeeds immediately → request-history-dependent, not auth/rate/context (total tokens ~93k, far below 1M).
Server response (400) — the whole body, no message/type/code:
{"object":"error","model":"deepseek-v4-flash"}
Headers: cf-ray: a3841a8abfa55e6e-EWR, server: cloudflare, content-length: 46.
Session id: ses_f7bb881c9ffeMAnYuiFH03531z (local DB) · Failed message attempts (local times 09-09): msg_084d5c2f20012zQrwgkcuHks4N, msg_084d79bc3001pVRqOSsGSdo352, msg_084d7c5b2001XpN0Y9saGCyeoQ, msg_084d854fe001g4RtX2d5KrAViz, msg_084d8cfc3001xZnvIk7IF2JTHK, msg_084d9914a001geKkKJa05S6112 (all error: APIError, statusCode 400).
Log (14:23–14:27 UTC+8): consecutive stream error ... AI_APICallError: Bad Request; note two sibling assistant messages share parent msg_084d53c0c001M3Kxl14TVMPiPg (retry after a 3-tool-call turn).
Hypothesis: DeepSeek V4 thinking-mode multi-turn contract (assistant messages must carry reasoning_content back; cf. DeepSeek V4 Flash: reasoning_content must be passed back to API when using thinking mode #24130 / fix(provider): complete DeepSeek reasoning_content round-trip for multi-turn conversations #24250 / DeepSeek V4 Pro (OpenRouter) reasoning_content error - v1.14.27 #24569). The zen/go gateway returns an opaque 46-byte error with no reason — please surface upstream detail and fix the round-trip; the error format itself is undiagnosable from the client.
Session: long-lived (2 days, ~22k events, heavy tool use; ~2 MB of active context, 82 assistant messages since the last compaction).
5 failures on 2026-09-22 between 07:12 and 07:27 UTC. Each failed step produced an empty assistant message (finish=error, content: []) and the client showed only Provider request failed with HTTP 400 — i.e. the body carried no error.message / message, consistent with the 46-byte {object:error,model:...} shape reported above.
After the first failure, retrying inside the same session kept failing (3 consecutive failures, including plain continue prompts). Other sessions on the same model + same variant + same account worked fine — so it is request-history dependent.
INFO logs only show Failed to drain Session plus the JS stack; request/response bodies are not logged, so the upstream reason is not recoverable client-side.
Looks like the same class as #48180 (reasoning_content echo-back × reasoning_effort), but on deepseek-v4.1-flash with an opaque body. Happy to provide exact timestamps / message IDs if useful.
It covers deepseek-v4-flash and deepseek-v4.1-flash, and matches only the body with no error information ({"object":"error","model":"..."}, the Provider request failed with HTTP 400 fallback, or a bare Bad Request).
Worth separating first, though, because this issue's thread mixes two causes: if your failures are the thinking-mode reasoning_content contract that the earlier comments hypothesise, retrying will not help — those are deterministic and switching model or dropping the #max variant is the lever (see the sibling report). The plugin only addresses the transient stub. My own install has not fired yet at a ~1 % failure rate, so I am explicitly asking for testers rather than claiming it works.
Finding (from on-disk session evidence): the failing session persisted 41 of 209 assistant turns as tool_use-only with no reasoning block. The request that failed replayed one of those (tool_use -> tool_result -> next request) and returned 400; every retry failed identically.
This matches the all-or-nothing rule captured in #25000: once any assistant message carries reasoning_content, every subsequent assistant message must too, or the relay rejects the whole request. Adding this as corroborating data from another client, not as a Cline-only bug.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Sep 9, 2026
This issue might be a duplicate of existing issues. Please check:
reasoning_contentinvalid_request on follow-up messages with OpenCodeZen DeepSeek-V4-Flash in thinking modereasoning_contentdropped in assistant tool-call messages causing 400 errors with DeepSeek thinking mode across turnsreasoning_contentis sent back in subsequent messageshpcx1234 commentedon Sep 22, 2026
Another data point:
deepseek-v4.1-flash#maxon Desktop 2.0.12 — same opaque-body 400, session-history dependentopencode-go/deepseek-v4.1-flash#max(OpenCode Go,https://opencode.ai/zen/go/v1); OpenCode Desktop 2.0.12, Windows.finish=error,content: []) and the client showed onlyProvider request failed with HTTP 400— i.e. the body carried noerror.message/message, consistent with the 46-byte{object:error,model:...}shape reported above.Failed to drain Sessionplus the JS stack; request/response bodies are not logged, so the upstream reason is not recoverable client-side.#maxor switch model) resolves it.Looks like the same class as #48180 (reasoning_content echo-back × reasoning_effort), but on
deepseek-v4.1-flashwith an opaque body. Happy to provide exact timestamps / message IDs if useful.SamSpiri commentedon Sep 29, 2026
Same class as the newer reports, on the older
deepseek-v4-flashid. A client-side retry for the opaque body, looking for testers:https://github.com/SamSpiri/opencode-go-stub-400-retry
It covers
deepseek-v4-flashanddeepseek-v4.1-flash, and matches only the body with no error information ({"object":"error","model":"..."}, theProvider request failed with HTTP 400fallback, or a bareBad Request).Worth separating first, though, because this issue's thread mixes two causes: if your failures are the thinking-mode
reasoning_contentcontract that the earlier comments hypothesise, retrying will not help — those are deterministic and switching model or dropping the#maxvariant is the lever (see the sibling report). The plugin only addresses the transient stub. My own install has not fired yet at a ~1 % failure rate, so I am explicitly asking for testers rather than claiming it works.erflores-tech commentedon Oct 9, 2026
Cross-reference from another client (Cline) that reproduces this on the same
opencode-go/deepseek-v4.1-flashConsole Go route.reasoning_content in the thinking mode must be passed back to the API- Cline replays tool_use-only assistant turns with no reasoning block (opencode-go / deepseek-v4.1-flash) cline/cline#14965Finding (from on-disk session evidence): the failing session persisted 41 of 209 assistant turns as
tool_use-only with no reasoning block. The request that failed replayed one of those (tool_use->tool_result-> next request) and returned 400; every retry failed identically.This matches the all-or-nothing rule captured in #25000: once any assistant message carries
reasoning_content, every subsequent assistant message must too, or the relay rejects the whole request. Adding this as corroborating data from another client, not as a Cline-only bug.thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊