Skip to content

[Bug] Anthropic API Error: Cannot modify thinking blocks during conversation compaction #13391

@0xjan888

Description

@0xjan888

Bug Description
2. Compaction tries to summarize - The /compact command attempts to condense the conversation history to save context space
3. API restriction - The Claude API has a strict rule: thinking blocks cannot be modified after they're created. They must stay exactly as they were.
4. Conflict! - The compaction process tried to modify a message that contains thinking blocks, which the API rejected with a 400 error.
Error:
Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.9.content.5: 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_011CVuV4mBXpumyhqzBStUBi"}

Environment Info

  • Platform: darwin
  • Terminal: cursor
  • Version: 2.0.61
  • Feedback ID: 9dfaa425-912c-4e6e-8c01-bd1148768f2b

Errors

[]

Metadata

Metadata

Assignees

No one assigned

    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