[BUG] CLAUDE_CODE_EXTRA_BODY thinking config breaks WebSearch and WebFetch on Opus 4.7 [1m]
Preflight Checklist
- [x] Searched existing issues — related but distinct: #50100, #51212 (Bedrock; closed/locked), #49322 / #49268 (the bug this config works around)
- [x] Single bug report
- [x] Latest Claude Code (2.1.131)
What's Wrong?
I run with the following in ~/.claude/settings.json as a workaround for #49322 (thinking summaries not rendering in VS Code extension on Opus 4.7):
"env": {
"CLAUDE_CODE_EXTRA_BODY": "{\"thinking\":{\"type\":\"adaptive\",\"display\":\"summarized\"}}"
}
This restores thinking summaries in the VSCode extension. But it also breaks WebSearch and WebFetch every time, because the harness forwards CLAUDE_CODE_EXTRA_BODY to internal sub-requests that can't accept those params:
WebSearch — uses tool_choice: {type: "tool", name: "web_search"} to force the search tool:
API Error: 400 Thinking may not be enabled when tool_choice forces tool use.
WebFetch — spawns a sub-call to a smaller summarization model that doesn't accept adaptive thinking:
API Error: 400 adaptive thinking is not supported on this model
So the user is stuck between two bugs: drop the env var → no thinking visible (#49322); keep it → no web tools.
What Should Happen?
CLAUDE_CODE_EXTRA_BODY is documented as a top-level request override. The harness should either:
- Strip incompatible fields (e.g.
thinking) from sub-requests that use forcedtool_choiceor that target models without adaptive-thinking support, or - Make it possible to scope
CLAUDE_CODE_EXTRA_BODYto top-level model calls only.
Ideally, fixing #49322 would also remove the need for this workaround entirely.
Steps to Reproduce
~/.claude/settings.jsonincludes:
``json``
"env": { "CLAUDE_CODE_EXTRA_BODY": "{\"thinking\":{\"type\":\"adaptive\",\"display\":\"summarized\"}}" }
/model claude-opus-4-7[1m]- Call WebSearch with any query → 400 above.
- Call WebFetch on any URL → 400 above.
- Remove the env var, restart, retry → both tools work, but #49322 returns (no thinking summaries in VSCode extension).
Claude Model
Opus (claude-opus-4-7[1m])
Claude Code Version
2.1.131
Platform
Anthropic API (direct)
Operating System
macOS 26.4.1 (Darwin 25.4.0 arm64)
Terminal/Shell
VS Code extension, zsh
Additional Information
Related: #49322, #49268 (the thinking-summary rendering bug this config works around), #50100, #51212 (Bedrock variants of the same [1m] + thinking incompatibility).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗