If Claude Code or your own app stops with the 400 error below, it means the API did not accept a thinking block you sent back with the conversation history as being "exactly as it was originally returned".
messages.1.content.0: Invalid `signature` in `thinking` block
Claude Code shows API Error: 400 in front of it (position numbers such as messages.1.content.0 are examples and change from conversation to conversation). Reports from the first half of 2026 (GitHub #21726 and others) also show it without the backticks, as Invalid signature in thinking block. Two other messages have the same cause. Each appears when the thinking block itself, or the conversation before it, has changed since the block was produced.
messages.{i}.content.{j}: Invalid `signature` in `thinking` block. The block is bound to a different conversation. Remove the block, or set `thinking.block_binding.prefix_mismatch_behavior` to "drop_block".
API Error: 400 messages.3.content.40: `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.
If it happened in Claude Code, it is not a mistake in your prompt or your code. The official API documentation says that when Claude Code manages the conversation history, there is nothing for you to change for the prefix check (section 2). Unless you go through a proxy or a different backend, the cause is on Claude Code's side. Fix it in this order: update to the latest version with claude update → with the prompt input empty, press Esc twice (or run /rewind) to go back to before the break → if that fails, start a new conversation with /clear. In your own app, keeping the history append-only prevents it, and a conversation that has already failed can continue with the drop_block setting or by removing the thinking from the named block onward.
Invalid `signature` in `thinking` block(nothing after it)The signature itself failed verification (truncated, altered, or sent back empty)
Claude Code: update, then
/rewind. Your own app: send the block back exactly as received... The block is bound to a different conversation. ...The signature is valid, but the
system,toolsor messages before that block changedContinue with
drop_blockor remove that block and the thinking after it, then keep the history append-only... cannot be modifiedA thinking block you sent back differs from what the API returned (despite "latest", it can be any turn)
Claude Code: update, then
/rewind. Your own app: send each assistant turn back whole and unchanged
Contents
1. Telling the three messages apart
The leading messages.1.content.0 is a zero-based position: which message in the messages array you sent, and which block inside it. messages.3.content.40 means "the 41st block of the 4th message", the first block that failed. The numbers change from conversation to conversation, so search for the text after the position.
The messages are also documented in different places. Claude Code's official Error reference lists cannot be modified under "Tool use or thinking block mismatch", while the form with bound to a different conversation appears in both the API's Troubleshooting thinking and Errors pages, and the bare Invalid `signature` in `thinking` block appears only in Troubleshooting thinking (checked on November 14, 2026).
| Message | Check that failed | Where it is documented | How to continue the stuck conversation |
|---|---|---|---|
Invalid `signature` in `thinking` block (ends there) | Verification of the signature itself (truncated, altered or empty) | API Troubleshooting thinking | Go back to before the break, or remove the thinking blocks (drop_block does not help) |
... bound to a different conversation ... | Comparison of everything before the block (the prefix check) | API Troubleshooting thinking and Errors | The drop_block setting, or remove that block and the thinking after it |
... cannot be modified ... | Match between the block you sent and the block the API returned | Claude Code Error reference and API Errors | Go back to before the break, then send the blocks back exactly as received |
The bound to a different conversation message can end with one more sentence naming what changed (the system prompt, tools, the first message that differs, and so on). The official docs say that sentence is for people and logs and its wording can change, so code should not match on it.
2. The two things a signature checks
The signature of a thinking block holds the full reasoning, encrypted (Thinking encryption in Thinking). The thinking field you see is a summary, and on newer models display defaults to "omitted", so it comes back empty. A block with empty text and only a signature is not broken. The server decrypts the signature to rebuild the original reasoning and ignores any text you put in the empty field. The signature value is the same whatever display is set to.
The signature is used for two checks. The first is whether the block itself is unchanged: it fails when the signature is missing, truncated, altered or sent back empty. Consecutive thinking blocks in the latest assistant message cannot be reordered, edited or partly dropped (the same applies to redacted_thinking). The second is the prefix check, run by models that carry thinking across turns. The signature records a fingerprint of the system, tools and messages before the block, and if any of that has changed when you send it, the thinking after the change becomes invalid (Prefix checks on thinking blocks).
What counts as a change in the prefix check, and what does not
- Counts
- Changing, inserting, moving or deleting an earlier message (any role), rewriting
system, changing one word of a tool description or adding and removing tools, changing text before the block in its own message, leaving out only a thinking block in between - Does not count
- Parameters such as
model,effort,max_tokens,tool_choiceandthinking.display, JSON formatting or key order,cache_controlmarkers, adefer_loading: truetool that nothing has referred to yet - Example
- An app that puts today's date in its system prompt invalidates all earlier thinking when the date changes. The official docs recommend stating the date in a new message at the end instead
- What you may leave out
- The oldest thinking, the newest thinking, or all of it (never just one in between). Thinking from a turn whose tool call is still open must always be sent back
What happens when a block fails the prefix check depends on the model. With prefix_mismatch_behavior unset, the official table on November 14, 2026 reads as follows.
| Model | When the check fails |
|---|---|
| Claude Fable 5.2, Mythos 5.2, Mythos 5.1 | 400 The request returns an error |
| Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5 | 400 or silent There may be no error, in which case the outdated thinking reaches the model and is billed |
| Models not in this table (such as Claude Opus 5) | No check On the Claude API the prefix check does not run at all |
Switching models or moving to another account does not cause this error. Thinking that the target model cannot read, and thinking from Sonnet 5.5, Haiku 5.5, Fable 5.2 and Mythos 5.2 outside the account that produced it (or a linked account), is dropped by the API without an error and without billing (Preserved thinking). The kinds of thinking (adaptive and extended) and each model's defaults are covered in Claude adaptive thinking explained.
3. Causes in Claude Code, and the versions that fixed them
Claude Code saves the conversation history itself (the session JSONL) and rebuilds it for every request. This error appears when, somewhere in that rebuild, a thinking block or the content before it no longer matches the original. The official changelog lists fixes of this kind again and again. Here are the main ones, grouped by what triggered them (the latest version on November 14, 2026 is v2.1.325).
| When it happened | Fixed in | Changelog entry (summary) |
|---|---|---|
| Running agents concurrently | v2.1.47 | Interleaved streaming blocks prevented proper message merging and caused cannot be modified |
A redacted thinking block (redacted_thinking) after a tool call | v2.1.136 | The 400 error in that situation |
| Switching models or logins | v2.1.152 | Stale signatures left in history got sessions stuck, now stripped before sending, with a retry if that fails |
| Normal tool use on Opus 4.8 | v2.1.156 | Thinking blocks were modified, causing API errors |
| After a first rejection | v2.1.259 | A conversation whose thinking was rejected once kept being rejected on every later turn |
| Conversations holding redacted thinking | v2.1.282 | Every turn failed with Invalid `data` in `redacted_thinking` block, now the thinking is dropped and the request retried once |
The "once it appears, every input repeats the same error" symptom was fixed in v2.1.259 and v2.1.282 (v2.1.282 drops the thinking and retries once). The older your version, the more unfixed paths remain. Other fixes continue for bugs where earlier thinking was discarded, for example when an MCP server disconnects mid-session, when a session is resumed with a different --tools list, or after /login, but those lose thinking and cache rather than raising this error.
Some reports are still unresolved. GitHub #10199 and #63147, where resuming an extended-thinking session gets stuck, were still open on November 14, 2026. #108706 from November 10, 2026 (v2.1.319) reports that resuming a conversation that starts with a compaction block makes Claude Code insert an empty system message among the kept turns, so the thinking after it fails the prefix check. The reporter observes that Claude Code sends drop_block, so there is no 400 and the thinking is silently dropped (this is a user's report, not an explanation from Anthropic).
The cause can also lie outside Claude Code. A proxy or gateway in front of the API (CLIProxyAPI, a company LLM gateway and so on) can rebuild messages, drop thinking blocks with empty text, or strip the anthropic-beta header, and produce the same error. There is also a report of the error happening only in the VS Code extension and not in the terminal (#52670), so trying the same conversation through another path helps narrow it down.
4. Fixing it in Claude Code, step by step
Try these from the top. Steps 1 and 2 recover most sessions, and step 3 always works but loses the conversation's flow.
- 1 Update
Check your version with
claude --version, update withclaude update, and resume the conversation (claude --continueor/resume). The official Error reference says that on Opus 4.7 and 4.8, versions before v2.1.156 can trigger this error during normal tool use and/rewinddoes not clear it, so update first. On v2.1.258 or earlier, the bug where every turn keeps failing after one rejection is also still present. - 2 Go back to before the break
With the prompt input empty, press Esc twice, or type
/rewind, to open the rewind menu (if the input has text, double Esc only clears it). Pick a prompt from before the error and choose Restore conversation (rewinds the conversation and keeps the current code). The selected prompt returns to the input field, so you can resend or edit it. All menu actions and what can and cannot be restored are covered in Claude Code checkpointing and /rewind. - 3 Start a new conversation
/clearstarts a new conversation that does not carry the broken block. You lose the previous conversation's flow, so first save decisions and work state in a git commit or a note, and give them to the new conversation at the start. Within the same process, the/resume <session-id> (previous session)entry at the top of the/rewindmenu takes you back to the conversation before the clear. - 4 Remove thinking from the history (last resort)
An unofficial option when you really need to keep the conversation. The API's official procedure is "remove the named block and every later
thinkingandredacted_thinkingblock, keep the other blocks, and resend", and this applies the same idea to the session JSONL. A community tool (miteshashar/claude-code-thinking-blocks-fixon GitHub) offersfix, which repairs only the broken parts, andnuke, which removes all thinking, and both create a backup automatically before writing. It was last updated in March 2026 and was built around the concurrent-streaming corruption fixed in v2.1.47. If you use it, quit Claude Code first. - 5 Suspect the path
If you go through a proxy, gateway or another extension, try the same thing directly (the
claudeterminal straight to Anthropic's API). If it does not happen directly, ask the administrator to check that the relay passes thinking blocks, empty thinking, theanthropic-betaheader andthinking.block_bindingthrough unchanged.
If it keeps reproducing, a GitHub report with your claude --version, the model, and what you did just before (resume, compaction, model switch, MCP reconnect and so on) helps the fix. Before posting, check that no API keys or personal paths appear in logs or screenshots.
5. Preventing it and recovering in your own app (API/SDK)
In an app that calls the Messages API itself, the cause is in your code or in a tool your requests pass through. The official docs name three habits that make the history append-only.
- Send each assistant turn back exactly as the API returned it, including thinking blocks with empty text
- Build
systemandtoolsonce per conversation and send that same copy every time - Put new instructions and changed values (date, files, added tools) in a new message at the end, and never remove it later
// ❌ Rebuilding the assistant message by picking blocks by type
const rebuilt = {
role: 'assistant',
content: response.content.filter(b => b.type === 'thinking' || b.type === 'tool_use'),
// redacted_thinking is lost and the order changes
};
// ❌ Deleting thinking blocks with empty text as "broken"
// On models where display defaults to "omitted", this is the correct shape
// ❌ Rebuilding system every request with today's date or a mode
// ✅ Append the returned content unchanged, add new things at the end
messages.push({ role: 'assistant', content: response.content });
messages.push({ role: 'user', content: [toolResult] });
When streaming, do not join the deltas yourself. Use the SDK's accumulation helper (stream.get_final_message() in Python, stream.finalMessage() in TypeScript) to get complete blocks with their signatures. Hand-written parsers tend to drop thinking blocks that received no text.
Two ways to continue a conversation that hit the error
Resending the same body, or fixing your code, does not help while the change is still in the stored history. The official docs give two options.
- Set drop_block
Send the beta header
thinking-binding-controls-2026-08-01and setthinking.block_binding.prefix_mismatch_behaviorto"drop_block"on the retry and every later request in that conversation. Invalid thinking is dropped and not billed. On Sonnet 5.5 and Haiku 5.5 it works only withthinking: {"type": "adaptive"}. Sendingblock_bindingwithout the header returns a 400 ending inblock_binding: Extra inputs are not permitted.It applies only to
bound to a different conversation. It does not help when the message ends atInvalid `signature` in `thinking` block(the signature itself is broken). The official docs also warn against sending it on all conversations to hide errors. - Remove the thinking
Remove the named block and every
thinkingandredacted_thinkingblock after it (in that message and all later ones), keep the other blocks, and resend. Leave the removed blocks out of later requests. Either way, Claude loses the reasoning that was removed.
// Continue with drop_block (TypeScript, shortened from the official example)
const response = await client.beta.messages.create({
model: 'claude-opus-5-5',
max_tokens: 16000,
thinking: {
type: 'adaptive',
block_binding: { prefix_mismatch_behavior: 'drop_block' },
},
messages,
betas: ['thinking-binding-controls-2026-08-01'],
});
// Dropped blocks are listed in response.input_transformations
If you send the same header and leave the setting unset, the response's input_transformations lists each block that failed the check and still reached the model, as thinking_mismatch_allowed. On the "400 or silent" models, logging this reveals mismatches that never raise an error. In tests, setting it to "error" turns every mismatch into a 400 on every model with preserved thinking, so nothing slips through.
If you build or run a proxy or gateway (from the official Libraries, proxies, and gateways section)
- Pass
anthropic-betavalues andthinking.block_bindingthrough as sent (dropping only the header while forwarding the setting returns a 400) - Return thinking blocks with empty text, and the
input_transformationsarray, to the caller unchanged - Do not move a
role: "system"message intosystem(that invalidates the thinking already in the conversation) - Do not hide the 400, and if you recover on the caller's behalf, tell them (their history still holds the change)
To slim down the history, do not delete turns in the middle yourself. Leave it to server-side context editing or compaction. Compaction at a token threshold and context editing never affect the prefix check. The Claude Agent SDK manages the history, so nothing is needed as long as the system prompt you give it stays the same. With other libraries such as the Vercel AI SDK, log the request bodies actually sent and check that they follow the three habits above.
6. Similar errors
| Message | Meaning | First step |
|---|---|---|
Invalid `signature` in `thinking` block | A thinking block's signature fails, or the content before it changed | Sections 4 and 5 of this article |
... thinking blocks ... cannot be modified | A thinking block you sent back differs from the original | Sections 4 and 5 of this article |
Invalid `data` in `redacted_thinking` block | The API does not accept a redacted thinking block | Retried automatically from v2.1.282, on older versions run claude update |
API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation. | The order of tool calls and results broke | /rewind (Claude Code errors reference) |
"thinking.type.enabled" is not supported for this model. ... | Extended thinking (budget_tokens) sent to a model that does not accept it | Switch to {"type": "adaptive"} and effort |
court or raw <invoke> appears | A tool call leaked out as text (not a 400) | The court / invoke article |
7. Prevention checklist
If you use Claude Code
- Keep Claude Code up to date (
claude update), since fixes of this kind land version by version - Commit important work to git often (your work survives even if you discard the conversation)
- In very long conversations,
/clearat natural break points or pick when to compact (When to run /compact) - If you go through a proxy or gateway, ask the administrator whether thinking blocks and beta headers pass through untouched
If you build with the API or an SDK
- Append each assistant turn's returned
contentunchanged (thinking,redacted_thinkingand empty thinking included) - Do not rebuild
systemortoolsmid-conversation, and state new values in a message at the end - When saving and resuming, store what you sent and what you received, and send exactly that
- In tests, set
prefix_mismatch_behaviorto"error"to surface mismatches as 400s
Summary
Invalid `signature` in `thinking` block and cannot be modified mean the API found that a thinking block you sent back, or the conversation before it, changed after the block was produced. The signature holds the full reasoning and, on newer models, a fingerprint of everything before it, so a single edit can invalidate all the thinking after it.
If it happened in Claude Code, it is not your mistake. Try claude update → Esc twice (/rewind) to go back to before the break → /clear, in that order. In your own app, keep the history append-only, and continue a failed conversation with drop_block or by removing the thinking.
FAQ
Q. Is this error a mistake in my prompt or code?
A. Not if it happened in Claude Code without a proxy or a different backend in between. The official API docs say there is nothing for you to change for the prefix check when Claude Code manages the history. Only when your own app calls the API should you review how it handles history (rebuilding turns, a dated system prompt, deleting empty thinking and so on).
Q. /rewind does not fix it.
A. Check your version with claude --version first and update. The official docs say that on Opus 4.7 and 4.8 with a version before v2.1.156, /rewind does not clear it. If updating does not help, start a new conversation with /clear.
Q. Can I avoid it by turning thinking off?
A. Many newer models cannot turn thinking off (Opus 5.5 and the Fable and Mythos models always think). Since v2.1.281 (v2.1.300 for the VS Code extension), Claude Code no longer offers the off switch on those models. Even where it can be turned off, quality drops, so updating and rewinding is the more practical fix.
Q. Does switching models or logging in with another account cause it?
A. Not on the API side. Thinking that a model cannot read, or that belongs to another account, is dropped by the API without an error. In Claude Code, the bug where stale signatures stuck around after a switch was fixed in v2.1.152.
Q. Are tools that delete thinking from the JSONL safe?
A. They are unofficial. Removing thinking follows the same idea as the official recovery procedure, but Claude Code's storage format changes between versions. If you use one, quit Claude Code and copy the JSONL first, and try the official fix (updating) before that.
Related Claude Code errors: Claude Code errors reference, "court" / leaked invoke tags, "Prompt is too long".
Related: Claude adaptive thinking explained, Claude Code checkpointing and /rewind.