Claude Code v2.1.167: Agent() spawn fails with "400 thinking options type cannot be disabled when reasoning_effort is set" on DeepSeek Anthropic-compatible endpoint
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
- Claude Code: v2.1.167 (npm global install)
- OS: Windows 11 x64
- API Endpoint:
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic - Main model:
ANTHROPIC_MODEL=deepseek-v4-pro(works fine for main conversation) - Sub-agent models:
ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4-flash,ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash(set at Windows User env level)
Steps to Reproduce
- Configure Claude Code to use DeepSeek's Anthropic-compatible endpoint
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropicANTHROPIC_MODEL=deepseek-v4-pro- Run any Agent spawn:
Agent({ model: "sonnet", subagent_type: "general-purpose", ... }) - Observe error:
API Error: 400 thinking options type cannot be disabled when reasoning_effort is set
Same error occurs with:
- WebSearch tool
- WebFetch tool
- All three Agent model tiers (sonnet/haiku/opus)
What Works
- Main conversation on
deepseek-v4-pro→ ✅ perfect - All non-subprocess tools (Read, Write, Edit, Bash, Grep, Glob, etc.) → ✅
What We Tested (Direct API Verification)
We ran 11 direct curl tests to DeepSeek's /anthropic/v1/messages endpoint with thinking: {type: "disabled"} combined with various parameters. All returned 200:
| # | model | extra params | Result |
|---|-------|-------------|--------|
| 1 | v4-pro | — | ✅ |
| 2 | v4-pro | tools:[...] | ✅ |
| 3 | v4-pro | tools + system | ✅ |
| 4 | v4-pro | tools + system + tool_choice:{type:"auto"} | ✅ |
| 5 | v4-pro | reasoning_effort:"high" | ✅ |
| 6 | v4-pro | budget_tokens:0 | ✅ |
| 7 | v4-flash | — | ✅ |
| 8 | v4-flash | tools + system | ✅ |
| 9 | claude-sonnet-4-20250514 | Anthropic model ID (mapped to v4-flash by DeepSeek) | ✅ |
This demonstrates that DeepSeek's Anthropic-compatible endpoint fully supports thinking: disabled — the 400 error is specific to Claude Code's Agent subprocess API request path.
Environment Variable Investigation
We tried setting ANTHROPIC_DEFAULT_SONNET/HAIKU_MODEL=deepseek-v4-flash via three different paths:
- settings.json
envblock - Windows User-level registry (permanent)
- Post-restart process inheritance
All three correctly set the env vars (confirmed via echo in subprocesses), but Agent spawn still fails with the same 400 — suggesting the Agent subprocess mechanism bypasses these env vars entirely.
Hypothesis
Claude Code's Agent subprocess API request construction differs from the main conversation path. The subprocess may:
- Send a parameter or header combination not covered by our direct API tests
- Use a different HTTP endpoint path
- Use a different SDK code path that triggers the error
Workaround
Direct execution by Team Lead (no Agent spawn). Quality is unaffected — verified with Critic review scoring 9.0/10 on directly-executed page reviews.
Additional Context
This bug was discovered during systematic /lint --system auditing of a production Obsidian knowledge base (~41K files). The Agent system (Writer/Critic/Researcher with state files, memory, and inter-agent cache channels) was fully deployed but had zero usage over 5 days because every spawn attempt failed silently. The knowledge base has comprehensive self-monitoring protocols that detected the anomaly.
What Should Happen?
Environment
- Claude Code: v2.1.167 (npm global install)
- OS: Windows 11 x64
- API Endpoint:
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic - Main model:
ANTHROPIC_MODEL=deepseek-v4-pro(works fine for main conversation) - Sub-agent models:
ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4-flash,ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash(set at Windows User env level)
Steps to Reproduce
- Configure Claude Code to use DeepSeek's Anthropic-compatible endpoint
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropicANTHROPIC_MODEL=deepseek-v4-pro- Run any Agent spawn:
Agent({ model: "sonnet", subagent_type: "general-purpose", ... }) - Observe error:
API Error: 400 thinking options type cannot be disabled when reasoning_effort is set
Same error occurs with:
- WebSearch tool
- WebFetch tool
- All three Agent model tiers (sonnet/haiku/opus)
What Works
- Main conversation on
deepseek-v4-pro→ ✅ perfect - All non-subprocess tools (Read, Write, Edit, Bash, Grep, Glob, etc.) → ✅
What We Tested (Direct API Verification)
We ran 11 direct curl tests to DeepSeek's /anthropic/v1/messages endpoint with thinking: {type: "disabled"} combined with various parameters. All returned 200:
| # | model | extra params | Result |
|---|-------|-------------|--------|
| 1 | v4-pro | — | ✅ |
| 2 | v4-pro | tools:[...] | ✅ |
| 3 | v4-pro | tools + system | ✅ |
| 4 | v4-pro | tools + system + tool_choice:{type:"auto"} | ✅ |
| 5 | v4-pro | reasoning_effort:"high" | ✅ |
| 6 | v4-pro | budget_tokens:0 | ✅ |
| 7 | v4-flash | — | ✅ |
| 8 | v4-flash | tools + system | ✅ |
| 9 | claude-sonnet-4-20250514 | Anthropic model ID (mapped to v4-flash by DeepSeek) | ✅ |
This demonstrates that DeepSeek's Anthropic-compatible endpoint fully supports thinking: disabled — the 400 error is specific to Claude Code's Agent subprocess API request path.
Environment Variable Investigation
We tried setting ANTHROPIC_DEFAULT_SONNET/HAIKU_MODEL=deepseek-v4-flash via three different paths:
- settings.json
envblock - Windows User-level registry (permanent)
- Post-restart process inheritance
All three correctly set the env vars (confirmed via echo in subprocesses), but Agent spawn still fails with the same 400 — suggesting the Agent subprocess mechanism bypasses these env vars entirely.
Hypothesis
Claude Code's Agent subprocess API request construction differs from the main conversation path. The subprocess may:
- Send a parameter or header combination not covered by our direct API tests
- Use a different HTTP endpoint path
- Use a different SDK code path that triggers the error
Workaround
Direct execution by Team Lead (no Agent spawn). Quality is unaffected — verified with Critic review scoring 9.0/10 on directly-executed page reviews.
Additional Context
This bug was discovered during systematic /lint --system auditing of a production Obsidian knowledge base (~41K files). The Agent system (Writer/Critic/Researcher with state files, memory, and inter-agent cache channels) was fully deployed but had zero usage over 5 days because every spawn attempt failed silently. The knowledge base has comprehensive self-monitoring protocols that detected the anomaly.
Error Messages/Logs
Steps to Reproduce
Environment
- Claude Code: v2.1.167 (npm global install)
- OS: Windows 11 x64
- API Endpoint:
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic - Main model:
ANTHROPIC_MODEL=deepseek-v4-pro(works fine for main conversation) - Sub-agent models:
ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4-flash,ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash(set at Windows User env level)
Steps to Reproduce
- Configure Claude Code to use DeepSeek's Anthropic-compatible endpoint
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropicANTHROPIC_MODEL=deepseek-v4-pro- Run any Agent spawn:
Agent({ model: "sonnet", subagent_type: "general-purpose", ... }) - Observe error:
API Error: 400 thinking options type cannot be disabled when reasoning_effort is set
Same error occurs with:
- WebSearch tool
- WebFetch tool
- All three Agent model tiers (sonnet/haiku/opus)
What Works
- Main conversation on
deepseek-v4-pro→ ✅ perfect - All non-subprocess tools (Read, Write, Edit, Bash, Grep, Glob, etc.) → ✅
What We Tested (Direct API Verification)
We ran 11 direct curl tests to DeepSeek's /anthropic/v1/messages endpoint with thinking: {type: "disabled"} combined with various parameters. All returned 200:
| # | model | extra params | Result |
|---|-------|-------------|--------|
| 1 | v4-pro | — | ✅ |
| 2 | v4-pro | tools:[...] | ✅ |
| 3 | v4-pro | tools + system | ✅ |
| 4 | v4-pro | tools + system + tool_choice:{type:"auto"} | ✅ |
| 5 | v4-pro | reasoning_effort:"high" | ✅ |
| 6 | v4-pro | budget_tokens:0 | ✅ |
| 7 | v4-flash | — | ✅ |
| 8 | v4-flash | tools + system | ✅ |
| 9 | claude-sonnet-4-20250514 | Anthropic model ID (mapped to v4-flash by DeepSeek) | ✅ |
This demonstrates that DeepSeek's Anthropic-compatible endpoint fully supports thinking: disabled — the 400 error is specific to Claude Code's Agent subprocess API request path.
Environment Variable Investigation
We tried setting ANTHROPIC_DEFAULT_SONNET/HAIKU_MODEL=deepseek-v4-flash via three different paths:
- settings.json
envblock - Windows User-level registry (permanent)
- Post-restart process inheritance
All three correctly set the env vars (confirmed via echo in subprocesses), but Agent spawn still fails with the same 400 — suggesting the Agent subprocess mechanism bypasses these env vars entirely.
Hypothesis
Claude Code's Agent subprocess API request construction differs from the main conversation path. The subprocess may:
- Send a parameter or header combination not covered by our direct API tests
- Use a different HTTP endpoint path
- Use a different SDK code path that triggers the error
Workaround
Direct execution by Team Lead (no Agent spawn). Quality is unaffected — verified with Critic review scoring 9.0/10 on directly-executed page reviews.
Additional Context
This bug was discovered during systematic /lint --system auditing of a production Obsidian knowledge base (~41K files). The Agent system (Writer/Critic/Researcher with state files, memory, and inter-agent cache channels) was fully deployed but had zero usage over 5 days because every spawn attempt failed silently. The knowledge base has comprehensive self-monitoring protocols that detected the anomaly.
Claude Model
Other
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.167 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗