[BUG] Session becomes completely unrecoverable due to thinking block API error

Resolved 💬 10 comments Opened Nov 30, 2025 by rmaher001 Closed Mar 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

Bug Description

During an extended Claude Code session, an API error occurs that makes the session completely unrecoverable. The error is related to thinking blocks being modified. Once this error occurs:

  • Cannot continue the conversation (any input triggers the error)
  • /compact fails with the same error
  • /clear - untested but context loss is unacceptable
  • The only option is to abandon the session and lose all context

This is a critical bug because it causes complete loss of work-in-progress with no recovery path.

Error Message

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.49.content.1: `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_011CVeW1YWWvLQ7fem8ut3YA"}

Environment

  • Claude Code Version: 2.0.55
  • Platform: macOS (Mac Mini M4 Pro, 64GB RAM)
  • macOS Version: 15.6.1 (Build 24G90)
  • Terminal: VS Code integrated terminal
  • Node Version: v22.16.0

Steps to Reproduce

  1. Use Claude Code for an extended session (in this case, 49+ messages based on error)
  2. At some point during normal usage, the error occurs
  3. Any subsequent input (including /compact) triggers the same error
  4. Session is completely stuck with no way to recover context

Expected Behavior

  1. Thinking blocks should be managed internally without corruption
  2. If corruption occurs, /compact should be able to recover by summarizing and starting fresh
  3. At minimum, there should be a way to export/save context before being forced to abandon the session

Actual Behavior

Session becomes completely unusable. User is forced to lose all conversation context and start over.

Impact

  • Severity: High
  • Complete loss of conversation context
  • Loss of work-in-progress
  • No recovery mechanism available
  • Forces user to restart and manually reconstruct context

Related Issues

This appears related to #11323 which describes a similar thinking block error after Ctrl+C interruption, though in this case no interruption was involved.

Additional Context

  • Error occurred during normal usage, no Ctrl+C or interruption
  • The session was working normally until this error appeared
  • Multiple installation paths detected (npm-local and npm-global) but this is likely unrelated

Suggested Fix

  1. Ensure thinking blocks are never corrupted during normal session flow
  2. Add a recovery mechanism (e.g., /compact --force or /recover) that can salvage context even when message structure is invalid
  3. Add ability to export conversation context before clearing

View original on GitHub ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗