Skip to content

[Bug] CLI: 400 reasoning_content error when using @file (Tool Calls) with DeepSeek API, regardless of thinking mode #12246

@qiaozheng9

Description

@qiaozheng9

Before submitting your bug report

Relevant environment info

- OS: Windows
- Continue version: CLI (Latest)
- IDE version: N/A (Using `cn` CLI directly)
- Model: DeepSeek-V4-Flash / DeepSeek-V4-Pro
- config:
  
  models:
    - name: DeepSeek-V4-Flash
      provider: deepseek
      model: deepseek-v4-flash
      apiKey: "sk-xxx"  # Masked
      apiBase: "[https://api.deepseek.com](https://api.deepseek.com)"
      completionOptions:
        maxTokens: 8192
      requestOptions:
        extraBody:
          thinking: 
            type: "disabled"

Description

Describe the bug
When using the Continue CLI (cn) with the DeepSeek API, referencing a file via @filename triggers MCP tool calls (e.g., Read, List). After the CLI successfully executes the tool locally, it attempts to send the tool output back to the API. During this context rebuilding phase for the tool-response loop, the CLI seems to strip or improperly format the message history.

This causes DeepSeek's strict API gateway to reject the request with a 400 error, complaining about missing reasoning_content in the assistant's previous message.

Crucial Note: This bug is triggered purely by the tool-call context loop. It happens even if using non-reasoning models (deepseek-v4-flash) or explicitly setting thinking: type: "disabled" in config.yaml.

To Reproduce
Steps to reproduce the behavior:

Ensure you are on the latest version of Continue CLI.

Configure a DeepSeek model in config.yaml as shown above.

Start a clean CLI session.

Input a prompt referencing a local file: @src/my_test_crew/crew.py please review this code.

Observe the CLI successfully invoking tools:
● Read(src/my_test_crew/crew.py)
⎿ Read tool output (198 lines)

Immediately after, the CLI throws the following error:
Error: 400 The reasoning_content in the thinking mode must be passed back to the API.

Expected behavior
When handling multi-turn conversations involving tool_calls and tool_responses, the CLI should retain the necessary message structure (e.g., appending an empty reasoning_content: "" string if required by the provider) to satisfy DeepSeek's API validation.

Temporary Workaround for Other Users
For those currently blocked by this, you can bypass the agentic tool-call loop by starting the CLI with tools disabled:
cn --exclude *
This forces the CLI to read the file locally and append it as raw text into the prompt, avoiding the tool-return loop and successfully bypassing the 400 error.

To reproduce

No response

Log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsRelates to tool usagekind:bugIndicates an unexpected problem or unintended behavioros:windowsHappening specifically on Windows

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions