Skip to content

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

Closed as duplicate

Description

@samuelkchris

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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.

Activity

  1. smconner commented on Nov 24, 2025

    @smconner

    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.

  2. art-shen commented on Nov 25, 2025

    @art-shen

    Breaks everything and neither manual nor automatic compaction works.

  3. liamhelmer commented on Nov 27, 2025

    @liamhelmer

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

  4. chibanaryan commented on Nov 28, 2025

    @chibanaryan

    Bump, ran into this issue. No compaction works.

  5. ryan-williams commented on Nov 28, 2025

    @ryan-williams

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

  6. deadeuzesse commented on Nov 28, 2025

    @deadeuzesse

    Bump, same here

  7. itinance commented on Nov 28, 2025

    @itinance

    same here

  8. just-another-dude commented on Nov 29, 2025

    @just-another-dude

    Same here

  9. ryan-williams commented on Nov 29, 2025

    @ryan-williams

    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.
  10. 3 remaining items

  11. neo-picasso-2112 commented on Nov 29, 2025

    @neo-picasso-2112

    not working guys

  12. mainely3d commented on Nov 29, 2025

    @mainely3d

    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.

  13. cozwoodiov commented on Nov 29, 2025

    @cozwoodiov

    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.

  14. cozwoodiov commented on Nov 29, 2025

    @cozwoodiov

    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:

    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.
  15. StayMeaty commented on Dec 3, 2025

    @StayMeaty

    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.

  16. itamarro commented on Dec 3, 2025

    @itamarro

    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.

  17. smconner commented on Dec 3, 2025

    @smconner
  18. chenyanv commented on Dec 5, 2025

    @chenyanv

    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.

  19. vitalragaz commented on Dec 8, 2025

    @vitalragaz

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

  20. alkanen commented on Dec 9, 2025

    @alkanen

    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.

  21. self-assigned this
    on Dec 9, 2025
  22. iamfinky commented on Dec 9, 2025

    @iamfinky

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

  23. github-actions commented on Dec 17, 2025

    @github-actions

    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.

  24. locked as resolved and limited conversation to collaborators on Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:apiarea:corebugSomething isn't workingduplicateThis issue or pull request already existshas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions