[Bug] Anthropic API Error: Cannot modify thinking blocks during message compaction

Resolved 💬 4 comments Opened Jan 12, 2026 by tszaks Closed Feb 27, 2026

Bug Description
Claude cannot compact. Error: Error: Error during compaction: Error: API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.4: 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_011CX32xuepmqnk6bgfad2w8"}

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.0.64
  • Feedback ID: e938996a-8ad1-4008-8b8b-adebaa1d1749

Errors

[{"error":"AxiosError: Request failed with status code 403\n    at AP (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:186:1137)\n    at IncomingMessage.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:187:9852)\n    at IncomingMessage.emit (node:events:520:35)\n    at IncomingMessage.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1701:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:89:21)\n    at UWA.request (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:189:2130)\n    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n    at async GG0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4548:3922)","timestamp":"2026-01-12T06:35:33.033Z"},{"error":"AxiosError: Request failed with status code 403\n    at AP (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:186:1137)\n    at IncomingMessage.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:187:9852)\n    at IncomingMessage.emit (node:events:520:35)\n    at IncomingMessage.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1701:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:89:21)\n    at UWA.request (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:189:2130)\n    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n    at async GG0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4548:3922)","timestamp":"2026-01-12T06:35:49.866Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.4: `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_011CX32CSHZZ7tBvPjrwJgRG\"}\n    at s2.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:121:10380)\n    at BR.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1145:2195)\n    at BR.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1145:5419)\n    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n    at async Lb2.C11.model (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4021:11055)\n    at async C11 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1925:3271)\n    at async Lb2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4021:11209)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4021:3864\n    at async _g1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1295:2037)\n    at async P7A (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4021:3834)","timestamp":"2026-01-12T06:36:37.891Z"},{"error":"Error: API Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.4: `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_011CX32CSHZZ7tBvPjrwJgRG\"}\n    at irA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1778:1564)\n    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n    at async bOB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1788:3233)\n    at async Dz (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2969:2566)\n    at async Dz (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2969:7757)\n    at async Dz (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2969:7757)\n    at async Dz (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2969:7757)\n    at async Dz (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2969:7757)\n    at async Dz (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2969:7757)\n    at async Dz (file:///opt/homebrew/lib/node_modules/@anthropic-ai/cl

Note: Error logs were truncated.

View original on GitHub ↗

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