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 }}
This repository was archived by the owner on May 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 15, 2026. It is now read-only.
[BUG] Deepseek V3.2 API error 400 after context condense #10175
Resuming task that has been condensed causes error when using deepseek v3.2 reasoning.
Context (who is affected and when)
I believe any user who is using deepseek v3.2 who closes and reopens a chat that has been condensed will hit this issue.
Reproduction steps
Using deepseek v3.2 reasoning.
Get context into the context window by any means.
Manually condense from the task bar.
error may present immediately, if not select new task from the top bar, reopen the same chat and select resume, error will present.
Expected result
Context condense process completes and task resumes and continues executing
Actual result
Error appears just after context condense halting any further task execution in this chat.
Variations tried (optional)
Issue was not present in
PR#9969
or
PR#9925
App Version
3.36.10
API Provider (optional)
DeepSeek
Model Used (optional)
Deepseek V3.2 Reasoning
Roo Code Task Links (optional)
No response
Relevant logs or errors (optional)
/time: 2025-12-18T03:13:20.310Z
Extension version: 3.36.10
Provider: deepseek
Model: deepseek-reasoner
DeepSeek completion error: 400 Missing `reasoning_content` field in the assistant message at message index 1. For more information, please refer to https://api-docs.deepseek.com/guides/thinking_mode#tool-calls
I've analyzed this issue and identified the root cause. Here's my proposed implementation plan:
Root Cause Analysis
The error "Missing reasoning_content field in the assistant message at message index 1" occurs because:
DeepSeek's API requirement: DeepSeek's reasoner model (deepseek-reasoner) requires ALL assistant messages to have a reasoning_content field when using thinking mode (see DeepSeek API docs)
Context condense creates summary without reasoning: When context is condensed, a summary message is created in src/core/condense/index.ts (lines 278-284) as an assistant message. This summary message has no reasoning_content field.
The conversion code conditionally adds reasoning_content: In src/api/transform/r1-format.ts (lines 196-199), reasoning_content is only added when it exists:
...(finalReasoning && { reasoning_content: finalReasoning }),
When finalReasoning is empty/undefined (as for summary messages), the field is omitted entirely.
DeepSeek rejects the request: When the task is resumed after condense, the summary message (assistant message at index 1) has no reasoning_content field, causing DeepSeek's API to reject the request.
Proposed Fix
Modify src/api/transform/r1-format.ts to ensure that when converting messages for DeepSeek's thinking mode (indicated by mergeToolResultText: true), ALL assistant messages include the reasoning_content field, even if empty:
// For thinking models, always include reasoning_content field on assistant messages
// DeepSeek's reasoner API requires this field to be present on all assistant messages
const shouldAlwaysIncludeReasoningContent = options?.mergeToolResultText === true
const assistantMessage: DeepSeekAssistantMessage = {
role: "assistant",
content: textParts.length > 0 ? textParts.join("\n") : null,
...(toolCalls.length > 0 && { tool_calls: toolCalls }),
// Always include reasoning_content for thinking models, empty string if no reasoning
...(finalReasoning
? { reasoning_content: finalReasoning }
: shouldAlwaysIncludeReasoningContent
? { reasoning_content: "" }
: {}),
}
This fix will be applied in two places in r1-format.ts:
Lines 193-199 (array content handling)
Lines 232-236 (string content handling)
Additional Changes
Add tests in src/api/transform/__tests__/r1-format.spec.ts to verify:
Summary messages get empty reasoning_content when mergeToolResultText: true
Non-thinking models remain unaffected (no reasoning_content added)
This approach ensures:
For non-thinking models: behavior remains unchanged
For thinking models (like deepseek-reasoner): reasoning_content is always present on assistant messages
Please mention @roomote in a comment saying that you approve this plan, and I'll proceed with the implementation.
Not sure if it helps or not but I have implemented this fix, built to vsix and installed.
Issue appears to be resolved during initial check.
ghost added a commit that references this issue on Dec 18, 2025
Date/time: 2025-12-23T08:38:24.046Z Extension version: 3.37.0 Provider: deepseek Model: deepseek-reasoner DeepSeek completion error: 400 Missing reasoning_content field in the assistant message at message index 53. For more information, please refer to https://api-docs.deepseek.com/guides/thinking_mode#tool-calls
Reproduction steps
Using Deepseek api key
Using deepseek-reasoner for Architect mode.
Using deepseek-chat for Code mode.
I plan with Architect mode with deepseek-reasoner
To implement the plan,Roo code suggested to switching to Code mode, I switched to Code mode
Roo code edit a file with deepseek-chat
To discuss about the updated code, I switch to Architect mode and ask something like, "with your new code I get this output"
And I get error: 400 (please check attached screenshot above)
Activity
[-][BUG][/-][+][BUG] Deepseek V3.2 API error 400 after context condense[/+]BowerMotorsport commentedon Dec 18, 2025
Not sure if it helps or not but I have implemented this fix, built to vsix and installed.
Issue appears to be resolved during initial check.
fix: ensure reasoning_content is always present for DeepSeek thinking…
KhalidYin commentedon Dec 22, 2025
It still appered the same issue in version 3.36.16
mahfuz-r commentedon Dec 23, 2025
I am getting similar error:
Date/time: 2025-12-23T08:38:24.046ZExtension version: 3.37.0Provider: deepseekModel: deepseek-reasonerDeepSeek completion error: 400 Missing reasoning_content field in the assistant message at message index 53. For more information, please refer to https://api-docs.deepseek.com/guides/thinking_mode#tool-callsReproduction steps
Using Deepseek api key
Using
deepseek-reasonerforArchitectmode.Using
deepseek-chatforCodemode.Architectmode withdeepseek-reasonerRoo codesuggested to switching toCodemode, I switched toCodemodeRoo codeedit a file withdeepseek-chatArchitectmode and ask something like, "with your new code I get this output"error: 400(please check attachedscreenshot above)hannesrudolph commentedon Jan 7, 2026
fixed a number of weeks ago. sorry for the delay.