Description
Bug Report: DeepSeek 4V Pro — reasoning_content 400 Error on Multi-turn Tool Calls
Error:
Error code: 400
Message: The reasoning_content in the thinking mode must be passed back to the API.
Type: invalid_request_error
Reproduction:
Start a new session with DeepSeek 4V Pro or DeepSeek 4V Flash (thinking mode enabled)
Make a request that triggers a tool call (e.g., run a command, search files)
On the second turn, the API returns 400
Root cause:
When an assistant message contains tool_calls, DeepSeek's V4 API requires that reasoning_content from that turn be replayed verbatim in all subsequent requests. The reasoning_content is extracted from the API response but silently dropped during message serialization before the next request is sent. Same root cause as GitHub issues DeepSeek thinking mode: reasoning_content not passed back for tool call turns, causing 400 errors #24722 , DeepSeek V4 Pro (OpenRouter) reasoning_content error - v1.14.27 #24569 , deepseek v4 pro开启前思考模式的时候api层丢弃reasoning_content导致接口调用失败 #24714 .
Expected behavior:
reasoning_content must be preserved in assistant messages that contain tool_calls when sending conversation history to DeepSeek's API.
Suggested fix:
For any assistant turn with tool_calls in a DeepSeek V4 thinking-mode conversation, inject reasoning_content: "" at the message root level on replay. Reference openclaw/openclaw PR Bash Permissions - one works all others do not #7110 , anomalyco/opencode PR fix(transform): inject reasoning_content for ALL assistant msgs to fix DeepSeek thinking mode #24150 .
Impact: Breaks every multi-turn conversation using DeepSeek 4V Pro/Flash with thinking mode. First turn works, any turn with a tool call fails.
Plugins
"plugin": [ "opencode-agent-skills", "oh-my-openagent@latest" ]
OpenCode version
1.14.30
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal
Description
Bug Report: DeepSeek 4V Pro — reasoning_content 400 Error on Multi-turn Tool Calls
Error:
Error code: 400
Message: The
reasoning_contentin the thinking mode must be passed back to the API.Type: invalid_request_error
Reproduction:
Root cause:
When an assistant message contains tool_calls, DeepSeek's V4 API requires that
reasoning_contentfrom that turn be replayed verbatim in all subsequent requests. Thereasoning_contentis extracted from the API response but silently dropped during message serialization before the next request is sent. Same root cause as GitHub issues DeepSeek thinking mode: reasoning_content not passed back for tool call turns, causing 400 errors #24722, DeepSeek V4 Pro (OpenRouter) reasoning_content error - v1.14.27 #24569, deepseek v4 pro开启前思考模式的时候api层丢弃reasoning_content导致接口调用失败 #24714.Expected behavior:
reasoning_contentmust be preserved in assistant messages that contain tool_calls when sending conversation history to DeepSeek's API.Suggested fix:
For any assistant turn with tool_calls in a DeepSeek V4 thinking-mode conversation, inject
reasoning_content: ""at the message root level on replay. Reference openclaw/openclaw PR Bash Permissions - one works all others do not #7110, anomalyco/opencode PR fix(transform): inject reasoning_content for ALL assistant msgs to fix DeepSeek thinking mode #24150.Impact: Breaks every multi-turn conversation using DeepSeek 4V Pro/Flash with thinking mode. First turn works, any turn with a tool call fails.
Plugins
"plugin": [ "opencode-agent-skills", "oh-my-openagent@latest" ]
OpenCode version
1.14.30
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal