Skip to content

Title: opencode-go / deepseek-v4-flash: continuing a long session returns 400 with opaque body {"object":"error","model":"deepseek-v4-flash"} #48093

Closed as not planned

Description

@sunpulun

Description

Version: 1.18.30 (Bun single-file build) · Provider: opencode-go (https://opencode.ai/zen/go/v1/chat/completions) · Model: deepseek-v4-flash, variant max, thinking mode
Steps

  1. Long agent session (message tree, ~93k tokens context, cache read 90k) in a repo with many tool rounds.
  2. 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).
  3. 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.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Sep 9, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. hpcx1234 commented on Sep 22, 2026

    @hpcx1234

    Another data point: deepseek-v4.1-flash#max on Desktop 2.0.12 — same opaque-body 400, session-history dependent

    • Provider/model: opencode-go/deepseek-v4.1-flash#max (OpenCode Go, https://opencode.ai/zen/go/v1); OpenCode Desktop 2.0.12, Windows.
    • 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.
    • Workaround that matches Console Go: DeepSeek V4.1 Flash #max fails on long multi-step runs — reasoning_content not passed back (HTTP 400) #48364: switching the session's model (drop #max or switch model) resolves it.

    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.

  3. SamSpiri commented on Sep 29, 2026

    @SamSpiri

    Same class as the newer reports, on the older deepseek-v4-flash id. A client-side retry for the opaque body, looking for testers:

    https://github.com/SamSpiri/opencode-go-stub-400-retry

    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.

  4. erflores-tech commented on Oct 9, 2026

    @erflores-tech

    Cross-reference from another client (Cline) that reproduces this on the same opencode-go / deepseek-v4.1-flash Console Go route.

    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.

  5. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions