Skip to content

Invalid Request: Mismatch in Thinking Block Parameters During API Call #2608

Closed

Description

@cexll

Bug Description
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.61: When providing
thinking or redacted_thinking blocks, the blocks must match the parameters during the original request."}}

Environment Info

  • Platform: darwin
  • Terminal: vscode
  • Version: 1.0.35
  • Feedback ID: 5c484ad4-a7cc-4eb8-9c18-33d6af8a27a3

Activity

  1. slavakurilyak commented on Jul 1, 2025

    @slavakurilyak

    Hey Anthropic team, I think I've figured out what's causing the widespread "thinking blocks must match parameters" error seen in issues #2608, #2746, #2573, #2171, #1755, and the related bug in #1179

    From what I can tell in the minified cli.js, when a user submits a long prompt with thinking budget ("think" < "think hard" < "think harder" < "ultrathink"), the client synthetically adds a {role: "assistant", content: [{type: "thinking"}]} message to the conversation history before making the API call

    The API then rejects this because it sees a thinking block it didn't create, which violates the protocol

    With access to the full source, you should be able to find this by searching for where that synthetic assistant message is pushed to the history, likely gated by a thinking budget flag and a line-count check

    Consider removing that client-side message injection and using the proper API parameters for extended thinking instead

    Hope this helps you consolidate these issues and track it down

  2. Kanezal commented on Jul 7, 2025

    @Kanezal

    need fix!

  3. Kanezal commented on Jul 19, 2025

    @Kanezal

    I think it was completely fixed, no such error for 3 hours straight.

  4. danneu commented on Nov 12, 2025

    @danneu

    Interesting, I just got this on claude-code v2.0.37.

    I don't have any good context to report since I wasn't doing anything peculiar when it happened. I had started the convo on one machine and it happened when I continued the convo on another machine through VNC, but I don't see how that could be related.

    I never encountered this issue in months of using claude-code.

  5. github-actions commented on Dec 13, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  6. github-actions commented on Dec 20, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiarea:modelautocloseIssue will be closed automaticallybugSomething isn't workingduplicateThis issue or pull request already existsplatform: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