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
The reasoning_content in the thinking mode must be passed back to the API. #24083
Call deepseek api to report the following error
Bad Request: {"error":{"message":"The reasoning_content in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
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
Reacted by 修昊, Hot Lava Pot, Artyom Maglinets (Артём Маглинец), R K, WHITEGEGEGE, hw11, Yuzhe Wang, Exploosion, 林赵鑫, Dean and 1 more
Steps to reproduce is empty — please describe what you were doing when the error occurred (e.g., which model, what prompt style, whether extended thinking/reasoning mode was enabled)
OpenCode version is missing — please provide the version you are running
Operating System is missing — please include your OS and terminal info
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
存在同样的问题,使用deepseek-v4-pro模型时,使用/review触发子线程后,子线程任务结束时主线程报错.
The same issue exists. When using the deepseek-v4-pro model, after triggering a sub-thread with /review, the main thread reports an error when the sub-thread task ends.
The `reasoning_content` in the thinking mode must be passed back to the API.
此问题在多次测试过程中必定触发,不清楚是API提供商问题还是opencode处适配问题,用作信息补充。
This issue consistently occurs across multiple tests. It is unclear whether it is a problem with the API provider or an adaptation issue with opencode. This is provided as supplementary information.
补充说明(来自deepseek web 专家模式)
当你开启 thinking: { type: "enabled" } 后,API 返回的响应中会多一个 reasoning_content 字段(模型的思考过程)。为了保持多轮对话中思考的连续性,DeepSeek API 要求在下一轮请求中,必须把上一轮 assistant 消息里的 reasoning_content 原样传回。
Bad Request: {"error":{"message":"The `content[].thinking` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.
Reacted by R K, ternence41, Andrei Tarutin, David Zheng, PJ568, quark-mac, Tasos Soukoulis, FirmianaSimplex-1247, Cheng Huang, Stanislav Yurin and 2 more
Activity
github-actions commentedon Apr 24, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
Small-tailqwq commentedon Apr 24, 2026
存在同样的问题,使用deepseek-v4-pro模型时,使用
/review触发子线程后,子线程任务结束时主线程报错.The same issue exists. When using the deepseek-v4-pro model, after triggering a sub-thread with /review, the main thread reports an error when the sub-thread task ends.
下面是我的配置文件:
Below is my configuration file::
此问题在多次测试过程中必定触发,不清楚是API提供商问题还是opencode处适配问题,用作信息补充。
This issue consistently occurs across multiple tests. It is unclear whether it is a problem with the API provider or an adaptation issue with opencode. This is provided as supplementary information.
补充说明(来自deepseek web 专家模式)
当你开启
thinking: { type: "enabled" }后,API 返回的响应中会多一个reasoning_content字段(模型的思考过程)。为了保持多轮对话中思考的连续性,DeepSeek API 要求在下一轮请求中,必须把上一轮 assistant 消息里的reasoning_content原样传回。如果在子线程
/review结束后,主线程拼接历史消息时,丢失或没有正确传递这个reasoning_content,API 就会报错:解法1:
如果 opencode 支持自定义消息处理,需要检查它是否保存并在下次请求时携带了
reasoning_content。格式类似:{ "role": "assistant", "content": "模型的最终回复", "reasoning_content": "模型的思考过程(上一次API返回的这个字段)" }解法2:关闭 thinking 模式
如果不需要思维链,可以在配置中去掉
thinking和reasoningEffort:其他解决方案:来自#24097 (comment)使用anthropic的接口格式来替换openai的接口格式:{ "npm": "@ai-sdk/anthropic", "name": "DeepSeek", "options": { "baseURL": "https://api.deepseek.com/anthropic", "apiKey": "sk-*****************" }, "models": { "deepseek-v4-pro": { "name": "DeepSeek-V4-Pro", "limit": { "context": 1048576, "output": 262144 }, "options": { "thinking": { "type": "enabled", "budgetTokens": 8192 } } }, "deepseek-v4-flash": { "name": "DeepSeek-V4-Flash", "limit": { "context": 1048576, "output": 262144 }, "options": { "thinking": { "type": "enabled", "budgetTokens": 8192 } } } } }此方案需要移除reasoningEffort参数,同时配合budgetTokens才能够正常使用。此方法只能作为临时解决方案,最终解决需要 opencode 添加对 deepseek 新模型的支持。此方法经过测试会引出一个新的故障:
devcxl commentedon Apr 24, 2026
存在同样的问题 我现在使用这个配置在会话中必定触发
AzureHalcyon commentedon Apr 24, 2026
环境:windows11 25H2
版本:OpenCode Desktop v1.4.6
修改~/.config/opencode/opencode.json:
问题:选择DeepSeek-V4-Pro进行多轮对话,几乎一定出现The
reasoning_contentin the thinking mode must be passed back to the API.报错。zhaojun8514-cmyk commentedon Apr 24, 2026
same issue
github-actions commentedon Apr 24, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.
valky86 commentedon Apr 24, 2026
It also occurs in DeepSeek V4 Flash, probably after five or six rounds of conversation.
DKeAlvaro commentedon Apr 25, 2026
I get the same issue
ZhaoCake commentedon Apr 26, 2026
Same issue. And it seemed that an error of provider, I used deepseek v4 pro in Copilot also occured this.