[BUG] API Error 400: Thinking Block Modification Error (Not a Duplicate)

Resolved 💬 24 comments Opened Nov 24, 2025 by samuelkchris Closed Dec 9, 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?

When viewing the TODO list using the ultrathink command, the following API error occurs, and thereafter the session is unrecoverable due to repeated 400 errors:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.20: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response."}}

This error is not reported as a duplicate and the issue occurs even after reviewing and searching all existing closed and open issues for similar errors. Please review as a unique bug.

What Should Happen?

Claude should handle long conversations or ultrathink/todo list queries without entering an unrecoverable error state. If thinking/redacted_thinking blocks cannot be modified (API constraint), Claude Code should detect this before submitting the request and fail gracefully or allow the session to recover.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.20: `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response."}}

Steps to Reproduce

  1. Run 'ultrathink whats next on our todo list' or similar prompt in a long-running session
  2. Trigger a response that would modify or replay an older assistant message containing a thinking or redacted_thinking block
  3. Observe repeated 400 error
  4. Session is unrecoverable until restarted

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.50 (Claude Code)

Platform

Other

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Please confirm this is not marked as a duplicate; prior similar errors do not match the triggering conditions of the ultrathink/todo list pathway for this API error. This is filed to ensure the root cause is distinctly tracked.

View original on GitHub ↗

24 Comments

smconner · 7 months ago

I'm getting the same API error. Not triggered by ULTRATHINK specifically.

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.3.content.20: thinking or redacted_thinking blocks in the latest assistant
message cannot be modified. These blocks must remain as they were in the original response."},"request_id":"req_011CVTRieUTEKMiQ1C6jnx8t"}

Using VS Code, on macos. Claude code terminal.

Unable to recover the conversation with: Tried close and /resume. Tried re-authenticating API key. Tried restarting VS Code.

I asked a new claude code conversation to debug the corrupted conversation and here is it's assessment:

What happened:

  1. User interrupted a request (lines 3965-3966: "Interrupted by user")
  2. After the interrupt, the conversation history appears to have been corrupted
  3. The user tried several times ("continue", "proceed", "test") but every API request failed with the same error
  4. The error indicates that thinking blocks from a previous response were being modified when resent, which the API doesn't allow

This appears to be a Claude Code client bug related to how the conversation history is reconstructed after a user interrupt, specifically involving thinking/extended thinking
blocks.

Recovered the conversation by using "Rewind" to go back a couple prompts before the error appeared.

art-shen · 7 months ago

Breaks everything and neither manual nor automatic compaction works.

liamhelmer · 7 months ago

bump, as I ran into the same issue. I interrupted a conversation shortly before doing the compact, perhaps this is relevant.

chibanaryan · 7 months ago

Bump, ran into this issue. No compaction works.

ryan-williams · 7 months ago

I don't think I interrupted anything, at least not immediately before this issue (maybe I did further back in my session, since prior compaction).

> You don't need to build for each change, FYI, I am just testing
against a dev server

⏺ Got it, thanks! Vite HMR will pick up changes automatically. Did the
  refresh fix work - are you seeing new data come in now?

> /compact
  ⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","e
    rror":{"type":"invalid_request_error","message":"messages.1.content.110:
     `thinking` or `redacted_thinking` blocks in the latest assistant
    message cannot be modified. These blocks must remain as they were in the
     original response."},"request_id":"req_011CVabpQpnGu12TC71YfJTF"}


> /compact
  ⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","e
    rror":{"type":"invalid_request_error","message":"messages.1.content.110:
     `thinking` or `redacted_thinking` blocks in the latest assistant
    message cannot be modified. These blocks must remain as they were in the
     original response."},"request_id":"req_011CVabqR2TeVCBsMv8Cjqxj"}


> /compact
  ⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","e
    rror":{"type":"invalid_request_error","message":"messages.1.content.110:
     `thinking` or `redacted_thinking` blocks in the latest assistant
    message cannot be modified. These blocks must remain as they were in the
     original response."},"request_id":"req_011CVabrCQxxCfoUcUYJkjJH"}


────────────────────────────────────────────────────────────────────────────
>
────────────────────────────────────────────────────────────────────────────
  ? for           Context low (11% remaining) · Run /compact to compact &
  shortcuts       continue

Persists across ^C + claude -c, not sure what to do.

I even gave it a normal prompt to write some state so I could start a new session, and got the same error (so it's not specific to /compact, it gave me this error in response to a "normal" prompt; whole session was broken).

deadeuzesse · 7 months ago

Bump, same here

itinance · 7 months ago

same here

just-another-dude · 7 months ago

Same here

ryan-williams · 7 months ago

Let's see if we can identify a specific version where the error was introduced.

  • I was seeing it on 2.0.55
  • OP said 2.0.50
  • I've just bumped down to 2.0.49, will report back if I see it there.
rezhboyu · 7 months ago

Same here

jared23 · 7 months ago
bump, as I ran into the same issue. I interrupted a conversation shortly before doing the compact, perhaps this is relevant.

this just happened to me as well, rewinding back to before the interrupt fixed it for me, but same, when i went to compact a little bit after the interrupt is when it gave me the api error. bumping for more eyes.

mknw · 7 months ago

up

edit: workaround I currently found is to: 1. type /model and select sonnet 4.5 (instead of Opus 4.5); 2. /compact

neo-picasso-2112 · 7 months ago

not working guys

mainely3d · 7 months ago

I'm seeing this too - Sonnet 4.5, continuing a conversation from a couple of weeks ago. No interruption, it had completed my changes. In my case I was able to /compact and clear the error.

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.

StayMeaty · 7 months ago

Happened to me just then, v2.0.56. After changing to Sonnet I was able to compact again.

I'm suprised to find out that Opus 4.5 is now the recommended/default model again, after they only recently made the Opus model almost unusuable due to the high token usage and told everyone to please use Sonnet for daily tasks. That was when they also introduced them new weekly limits.

itamarro · 7 months ago

I had a case where even Sonnet 4.5 failed to compact - switched down to Haiku to compact and then back up to Opus to continue working ...

but FWIW, as a heavy CC user who was affected by the limitations @StayMeaty mentioned - in my experience, as of 4.5, Opus uses comparatively fewer tokens to get tasks done. Overall the 4.5 Opus launch + switch to default been a great experience and a very successful launch IMHO, this bug notwithstanding.

smconner · 7 months ago

I’m in agreement with Itamar.

On Wed, Dec 3, 2025 at 8:53 AM Itamar Rogel @.***>
wrote:

itamarro left a comment (anthropics/claude-code#12225) <https://github.com/anthropics/claude-code/issues/12225#issuecomment-3604693417> I had a case where even Sonnet 4.5 failed to compact - switched down to Haiku to compact and then back up to Opus to continue working ... but FWIW, as a heavy CC user who was affected by the limitations @StayMeaty <https://github.com/StayMeaty> mentioned - in my experience, as of 4.5, Opus uses comparatively fewer tokens to get tasks done. Overall the 4.5 Opus launch + switch to default been a great experience and a very successful launch IMHO, this bug notwithstanding. — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/12225#issuecomment-3604693417>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABWQMDR7G34ADDM4ZBD5OD37Y7C7AVCNFSM6AAAAACM7GBZNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMBUGY4TGNBRG4> . You are receiving this because you commented.Message ID: @.***>
chenyanv · 7 months ago

I got the same error when I tried to click /compact, with the Sonnet 4.5 model. When all the context is used up, the agent gets stuck on "prompt is too long" and becomes completely unresponsive. Hard failure.

vitalragaz · 7 months ago

+1 running constantly into it when the a chat gets accidentally interrupted.

alkanen · 7 months ago

I sporadically get the same error message on Sonnet 4.5 without even running /compact, just in the middle of a conversation. Claude says that a task is done and asks me what to do next, and when I write a prompt I get this error about not modifying thinking blocks.

iamfinky · 7 months ago

+1 ran into this for the first time today _while using Sonnet 4.5_ - otherwise CC is my go-to AI choice these days

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.