[BUG] Error during compaction: Error: API Error: 400

Resolved 💬 20 comments Opened Nov 13, 2025 by pdvmovil Closed Nov 17, 2025

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?

Auto compacting conversation breaks and loses ability to continue. Must /clear and move on losing all previous context.

⎿  Context low · Run /compact to compact & continue

/compact

⎿  Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"clear_thinking_20251015 strategy requires thinking to be
enabled"},"request_id":"req_011CV5GKqn5UXHegb6p6X3qh"}

What Should Happen?

Should compact conversation and continue with previous context.

Error Messages/Logs

> /compact
  ⎿  Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`clear_thinking_20251015` strategy requires `thinking` to be
     enabled"},"request_id":"req_011CV5G9fEoAybGwoHK6PhxF"}

> /compact
  ⎿  Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`clear_thinking_20251015` strategy requires `thinking` to be
     enabled"},"request_id":"req_011CV5GFKounnQkbjFncUVp3"}

> /compact
  ⎿  Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`clear_thinking_20251015` strategy requires `thinking` to be
     enabled"},"request_id":"req_011CV5GFW73FdfX2fqFC3qei"}

> /compact
  ⎿  Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`clear_thinking_20251015` strategy requires `thinking` to be
     enabled"},"request_id":"req_011CV5GFgV7kfHEhjNH1uAcw"}

> /compact
  ⎿  Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`clear_thinking_20251015` strategy requires `thinking` to be
     enabled"},"request_id":"req_011CV5GG4m4p6kML4Msvh4oa"}

Steps to Reproduce

Use ClaudCode latest version long enough to auto compact conversation.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.31

Claude Code Version

2.0.36

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

20 Comments

homains-ou · 8 months ago

for now write the word "ultrathink" before your command , that fixes the issue

pdvmovil · 8 months ago
for now write the word "ultrathink" before your command , that fixes the issue

before every command, or just at the time it fails?

mbinde · 8 months ago

Writing "ultrathink" did not fix it for me, I had to just use /clear. Updating: and that instance of Claude fails to autocompact again when the context hits 0% again. So rather than using /clear, it's better to just start a new Claude.

hsellik · 8 months ago

Had the same error, worked with ultrathink, but seemed weird, updated claude-code via Homebrew and now it works properly.

ngregorich · 8 months ago

I ran into a similar issue

  • claude 2.0.42
  • macOS 15.7.1
  • WezTerm 20240203-110809-5046fc22
  1. /clear did not work for me
  2. I didn't try ultrathink
  3. /quit then claude did work for me
Physics-of-Data · 8 months ago

❌️ /clear
❌️ /quit
❌️ reinstall claude
❌️ deleted $HOME/.claude
❌️ deleted all custom commands

/ultrathink seems to work but wouldn't be wasting precious tokens?

Claude is of the opinion that the problem is in the app and the API server.

8erya · 8 months ago

I encountered this exact error on 2.0.36. The root cause is a conflict with the clear_thinking_20251015 strategy in older versions.

Solution

Update to the latest version (currently 2.0.42):

npm install -g @anthropic-ai/claude-code@latest

After updating, /compact works as expected.

WSL Users

If claude --version still shows 2.0.36 after updating, you may have multiple installations. Check with:

which claude

If it points to /mnt/c/Users/[username]/AppData/Roaming/npm/claude, you have a stale Windows installation taking precedence. Remove it:

rm /mnt/c/Users/[username]/AppData/Roaming/npm/claude*
rm -rf /mnt/c/Users/[username]/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code

Then reinstall on the Linux side:

npm install -g @anthropic-ai/claude-code@latest

Can confirm this resolves both the /compact error and the clear_thinking strategy issue.

pdvmovil · 8 months ago
I encountered this exact error on 2.0.36. The root cause is a conflict with the clear_thinking_20251015 strategy in older versions. ### Solution Update to the latest version (currently 2.0.42): npm install -g @anthropic-ai/claude-code@latest After updating, /compact works as expected. ### WSL Users If claude --version still shows 2.0.36 after updating, you may have multiple installations. Check with: which claude If it points to /mnt/c/Users/[username]/AppData/Roaming/npm/claude, you have a stale Windows installation taking precedence. Remove it: rm /mnt/c/Users/[username]/AppData/Roaming/npm/claude* rm -rf /mnt/c/Users/[username]/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code Then reinstall on the Linux side: npm install -g @anthropic-ai/claude-code@latest Can confirm this resolves both the /compact error and the clear_thinking strategy issue.

No longer an issue for me either after upgrading.

devbeno · 8 months ago
I ran into a similar issue claude 2.0.42 macOS 15.7.1 * WezTerm 20240203-110809-5046fc22 1. /clear did not work for me 2. I didn't try ultrathink 3. /quit then claude did work for me

only this solution work

szwang · 8 months ago

Closing as this is fixed as of 2.0.37 — so sorry for the friction here, and thank you for reporting!

grzegorzdrozda-lab · 8 months ago

I just click tab to turn on thinking and now it works

Theshedman · 7 months ago

I am having this issue now. Claude version 2.0.46

ericdfields · 7 months ago

Same issue and version as @Theshedman

pankajvkulkarni · 7 months ago

⎿  API Error: 400 {"message":"context_management.edits.0: Input tag 'clear_thinking_20251015' found using 'type' does not match any of the expected tags:
'clear_tool_uses_20250919'"}

claude --version
2.0.47 (Claude Code)

zeenix · 7 months ago

Same here as @pankajvkulkarni wrote. It's getting very annoying.

juliankrispel · 7 months ago

Same here, super annoying: clear_thinking_20251015 strategy requires thinking to be enabled`

Physics-of-Data · 7 months ago
Closing as this is fixed as of 2.0.37 — so sorry for the friction here, and thank you for reporting!

Where is 2.0.37?
The issue with 'clear_thinking_20251015' still is here. I cannot get the latest with npm install -g @anthropic-ai/claude-code@latest.

cozwoodiov · 7 months ago

Confirming this on v2.0.55, Linux (Ubuntu/Debian).

Impact on workflow:
This bug is causing serious workflow disruption. When compaction fails, Claude Code enters a death spiral of repeated errors until the session becomes completely unusable and
loses all context.

Current workaround:
I have to proactively monitor for compaction errors and /clear the session before total failure, timing it after documenting work-in-progress. This means:

  • Losing conversation context every few hours
  • Interrupting work to document before clearing
  • Restarting conversations from scratch repeatedly
  • Significant productivity loss

Configuration:

  • alwaysThinkingEnabled: true in ~/.claude/settings.json
  • Extended thinking enabled globally
  • Still experiencing compaction failures

Note on issue #11533:
This was marked as "fixed in v2.0.37" and closed on Nov 17, but the bug is clearly still present in v2.0.55 (latest version). This appears to be a regression that needs immediate
attention.

This needs to be prioritized - the current state makes Claude Code unreliable for long work sessions.

cozwoodiov · 7 months ago

Update: Bug Isolated to Opus 4.5 (2025-11-29)

Finding: Successfully completed conversation compaction using Sonnet 4.5 without encountering hallucination issues. This confirms the bug is specific to Opus 4.5, not
Sonnet 4.5.

Workaround for Users:
If you encounter conversation compaction hallucinations, switch to Sonnet 4.5:
```bash
claude --model sonnet

Test Results:

  • ✅ Sonnet 4.5: Conversation context preserved correctly, no fabricated content
  • ❌ Opus 4.5: Hallucinations during compaction (original bug reports)

This suggests the issue is model-specific and can be avoided by using Sonnet until Opus compaction is fixed.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.