claude-code - 💡(How to fix) Fix [Bug] Anthropic API Error: Cannot modify thinking blocks from different model versions

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

[{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.13.content.7: 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_011CbVRHzxtGt7mDqrfzjN6d"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:12:47.516Z"},{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.13.content.7: 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_011CbVRbFSzZt5J1V3L6X19M"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:16:41.583Z"},{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.13.content.7: 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_011CbVReTuRj2SQAyqQRSJ5F"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:17:25.123Z"},{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.3.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_011CbVRt8YVD4pBv7fC79ncc"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:20:30.525Z"}]

Code Example

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.13.content.7: `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_011CbVRHzxtGt7mDqrfzjN6d\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:12:47.516Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.13.content.7: `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_011CbVRbFSzZt5J1V3L6X19M\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:16:41.583Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.13.content.7: `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_011CbVReTuRj2SQAyqQRSJ5F\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:17:25.123Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.3.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_011CbVRt8YVD4pBv7fC79ncc\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:20:30.525Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Title: 400 "thinking blocks cannot be modified" when editing/rewinding history created under a different model (4.7 → 4.8)

What happened: When a conversation contains thinking blocks generated by one model (e.g. Claude 4.7) and I then touch that history — switch models, edit a previous message, or rewind — the next request fails with:

API Error: 400 messages.3.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.

Repro steps:

  1. Start a conversation with extended thinking under model 4.7 (so the history contains signed thinking blocks).
  2. Switch the active model (e.g. to 4.8), and/or edit or rewind to a prior assistant turn.
  3. Send the next message → 400 on the thinking block in the latest assistant message.

Frequency: Reproducible — happens essentially every time history from 4.7 is touched after a model change/edit/rewind.

Expected: The harness should not replay a thinking block signed by a different model as the latest assistant turn — it should strip or regenerate cross-model thinking blocks (or warn) rather than surface a raw 400. Editing/rewinding history that contains thinking should degrade gracefully.

Likely cause: Thinking-block signatures are tied to the producing model. Re-submitting a 4.7-signed block into a turn handled by another model makes the API treat it as modified/foreign.

Environment:

  • Claude Code, model switched from 4.7 to Opus 4.8 (1M context)
  • Platform: macOS (Darwin 25.5.0)

Environment Info

  • Platform: darwin
  • Terminal: phpstorm
  • Version: 2.1.154
  • Feedback ID: 626557c8-069a-4fbd-898a-b5a31176d073

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.13.content.7: `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_011CbVRHzxtGt7mDqrfzjN6d\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:12:47.516Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.13.content.7: `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_011CbVRbFSzZt5J1V3L6X19M\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:16:41.583Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.13.content.7: `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_011CbVReTuRj2SQAyqQRSJ5F\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:17:25.123Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.3.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_011CbVRt8YVD4pBv7fC79ncc\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:63816)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-28T18:20:30.525Z"}]

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