anomalyco / anomalyco/opencode
Title: opencode-go / deepseek-v4-flash: continuing a long session returns 400 with opaque body {"object":"error","model":"deepseek-v4-flash"}
Open
@rekram1-node is already working on this.
Since Sep 9, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
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
- 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. #24130 / #24250 / #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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.