Repository navigation
Description
Description
Fresh session, first turn works (reasoning summary streams back); any second turn fails with 400 — but only against Responses gateways that strictly validate input items. Same two turns succeed against lenient upstreams.
Root cause (verified below): on turn 2, opencode replays the previous turn's typed items (type: reasoning / type: message) without the provider-side ids (rs_* / msg_*). Gateways requiring id on typed items reject the request:
Opencode failed to send message with error: Invalid value for 'input.2.id': expected a value.
Minimal repros against the gateway (POST /v1/responses, stream: true):
# reasoning item WITHOUT id -> 400, same error template as the client
{"input":[
{"role":"user","content":"hi"},
{"type":"reasoning","summary":[{"type":"summary_text","text":"..."}]},
{"type":"message","id":"msg_real123","role":"assistant","status":"completed",
"content":[{"type":"output_text","text":"hi!"}]},
{"role":"user","content":"what can you do?"}]}
# -> {"param":"input.1.id","message":"Invalid value for 'input.1.id': expected a value."}
# message item WITHOUT id -> 400 as well
{"input":[
{"role":"user","content":"hi"},
{"type":"message","role":"assistant","status":"completed",
"content":[{"type":"output_text","text":"hi!"}]},
{"role":"user","content":"why?"}]}
# -> {"message":"Invalid value for 'input.1': Responses output message status requires an item id."}Control cases (all 200): role-based messages, typed items with id, function_call_output replays.
Related but distinct from #5104: in Dec 2025 (v1.0.133) the replay carried id + encrypted_content and died on crypto verification; now it carries no id and dies on id validation. Lenient upstreams accept the id-less replay, which is likely why this went unnoticed.
Possible fixes (maintainer's call): preserve provider item ids when round-tripping typed items, skip replaying id-less/empty reasoning items, or put it behind an option.
Provider/model config (keys redacted; same failure via two different baseURLs with identical model options, so it's not gateway-specific):
"experientiallabs": {
"npm": "@ai-sdk/openai",
"name": "ExperientialLabs Direct",
"options": {
"baseURL": "https://api.experientiallabs.ai/v1",
"apiKey": "<redacted>"
},
"models": {
"gpt-5.6-luna": {
"name": "GPT-5.6 Luna",
"modalities": { "input": ["text", "image"], "output": ["text"] },
"options": {
"reasoningEffort": "max",
"reasoningSummary": "detailed",
"include": ["reasoning.encrypted_content"],
"maxTokens": 32000
},
"variants": {
"max": { "reasoningEffort": "max", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
"xhigh": { "reasoningEffort": "xhigh", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
"high": { "reasoningEffort": "high", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
"medium": { "reasoningEffort": "medium", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
"low": { "reasoningEffort": "low", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] }
},
"limit": { "context": 256000, "input": 224000, "output": 32000 }
}
}
}Plugins
opencode-mem
OpenCode version
1.18.30 (running inside OpenChamber)
Steps to reproduce
- Point
@ai-sdk/openaiat any strict Responses gateway (reasoningSummary: detailedso turn 1 yields a reasoning item). - New session, send
hi→ works. - Send a second message →
Invalid value for 'input.2.id': expected a value.(see screenshot). - Same two turns against a lenient upstream → both succeed.
Screenshot and/or share link
Screenshot attached below (turn 1 streams reasoning summary + answer; turn 2 errors; bottom bar shows the direct-gateway model in use).
Operating System
Windows 11 (WSL backend)
Terminal
OpenChamber desktop v1.22.2 (hosting opencode web UI)
Activity
chaos-318 commentedon Sep 11, 2026
Here is the screenshot
github-actions commentedon Sep 11, 2026
This issue might be related to existing issues tracking reasoning item replay problems. Please check:
rs_A:rs_B) replayed after restart causesinvalid_request_error— similar failure surface (reasoning item ids in replay), different trigger (staleness after restart vs. ids dropped entirely on every multi-turn)These are distinct root causes but may share a fix area in the reasoning-item serialization/replay path.
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊