Skip to content

bug + deepseek #25058

@vr2uiu

Description

@vr2uiu

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:

  1. Start a new session with DeepSeek 4V Pro or DeepSeek 4V Flash (thinking mode enabled)
  2. Make a request that triggers a tool call (e.g., run a command, search files)
  3. 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions