claude-code - 💡(How to fix) Fix [BUG] CLAUDE_CODE_EXTRA_BODY thinking config breaks WebSearch and WebFetch on Opus 4.7 [1m]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

API Error: 400 Thinking may not be enabled when tool_choice forces tool use.

Root Cause

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:

Fix Action

Fix / Workaround

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):

Ideally, fixing #49322 would also remove the need for this workaround entirely.

Code Example

"env": {
  "CLAUDE_CODE_EXTRA_BODY": "{\"thinking\":{\"type\":\"adaptive\",\"display\":\"summarized\"}}"
}

---

API Error: 400 Thinking may not be enabled when tool_choice forces tool use.

---

API Error: 400 adaptive thinking is not supported on this model

---

"env": { "CLAUDE_CODE_EXTRA_BODY": "{\"thinking\":{\"type\":\"adaptive\",\"display\":\"summarized\"}}" }
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • Searched existing issues — related but distinct: #50100, #51212 (Bedrock; closed/locked), #49322 / #49268 (the bug this config works around)
  • Single bug report
  • 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 forced tool_choice or that target models without adaptive-thinking support, or
  • Make it possible to scope CLAUDE_CODE_EXTRA_BODY to top-level model calls only.

Ideally, fixing #49322 would also remove the need for this workaround entirely.

Steps to Reproduce

  1. ~/.claude/settings.json includes:
    "env": { "CLAUDE_CODE_EXTRA_BODY": "{\"thinking\":{\"type\":\"adaptive\",\"display\":\"summarized\"}}" }
  2. /model claude-opus-4-7[1m]
  3. Call WebSearch with any query → 400 above.
  4. Call WebFetch on any URL → 400 above.
  5. 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).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING