Fix guides · Claude Code, Cursor ·
Fix Claude Code "Invalid signature in thinking block" (400)
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.0: Invalid `signature` in `thinking` block"}}
Claude Code sends the thinking blocks from your conversation history back to the API. If a thinking block was edited, reordered, filtered, or came from a different model or provider, its signature no longer matches and the API rejects the request with HTTP 400. The fix is to start a new session, or send the assistant message back unchanged including every thinking block.
Common causes – and how to tell which one you have
1. Thinking block edited or reordered before resending
How to tell: You write your own tool-use loop and rebuild or filter assistant content between turns. The error names a content block index such as messages.1.content.0.
Fix: Send the assistant message back exactly as received, including every thinking block, then append the tool_result. Never filter, reorder, or edit thinking blocks.
2. Switched model or base URL mid-conversation
How to tell: The error appeared right after you changed models, swapped API providers, or changed the base URL. Thinking blocks are signed against the model and conversation that produced them, so old signatures stop matching.
Fix: Start a new session with /clear rather than resuming the affected one. Keeping one model and base URL for a conversation avoids the problem.
How to fix it
- Read the error text: it names the bad block position, e.g. messages.1.content.0, and says Invalid `signature` in `thinking` block.
- Find where your code rebuilds, filters, reorders, or merges thinking blocks before sending it back to the API.
- Send the assistant message back EXACTLY AS RECEIVED, including every thinking block, followed by the tool_result blocks.
- Append the tool_result blocks after the unchanged assistant message, one per tool_use, with results FIRST in each block.
- Re-run the request and confirm it returns 200 instead of 400.
Using Lovable, Bolt or v0?
This error is rare in tools that manage conversation history internally. If you see it, start a new chat and re-paste your code rather than resuming. If you built a custom agent loop, tell the tool to send the whole assistant message unchanged, including thinking blocks, and add the tool_result after it. Do not ask it to regenerate signatures.
Using Cursor, Claude Code or Windsurf?
Ask the agent to find the code path that builds the messages array for the API call and show how assistant content is handled between turns. Have it print the assistant message before and after that step to prove nothing was filtered, reordered, or rebuilt. Then verify the request returns 200. If using /clear, confirm it starts a new session rather than resuming the current one.
The “fix” to avoid
Agents often retry the same request, which fails again because the signature is still invalid. Others delete or edit the thinking blocks, hand-write a signature, or disable thinking to dodge the error. Editing thinking blocks makes the signature worse, hand-written signatures are rejected, and disabling thinking changes the model's behaviour. Start a new session instead of trying to fix the signature.
Copy-paste fix prompt for your AI coding tool
Paste this into Cursor, Claude Code, Lovable or Bolt:
My Claude Code calls fail with API Error 400 invalid_request_error: messages.1.content.0: Invalid `signature` in `thinking` block. Check in order: 1) Did I switch models, base URL, or account mid-conversation, or resume a fork? 2) Did my own code rebuild, filter, reorder, or merge thinking blocks before resending? Fix: send the last assistant message exactly as received, unchanged, then append tool_result blocks one per tool_use with results first. Verify the request returns 200.
Questions people ask
Is this a rate limit or a billing error?
No. It is HTTP 400 invalid_request_error, not 429. The request was rejected before the model ran, because a thinking block in your history has a signature the API cannot verify.
Why did it start failing after I switched models?
Thinking blocks are signed against the model and conversation that produced them, so after a switch the old signatures no longer match. Start a fresh session rather than resuming the affected one.
Can I just remove the signature field?
No. An empty or missing signature fails the same check. The API requires thinking blocks from the last assistant turn in a tool-use loop to be sent back unmodified, so do not drop or edit thinking blocks to work around it.