GrepBoard/Manuals
605 manuals ·

Claude API: thinking block is bound to a different conversation

·Tested on Claude API official docs · 2026-10·Test scope ↓·6 steps

Claude API 400 Invalid signature in thinking block: earlier history was edited. Make history append-only; use drop_block with the beta header as a stopgap.

text
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".

The system prompt, tools or messages before a replayed thinking block differ from what they were when the block was produced, so the API returns 400 invalid_request_error. The fix is to make your conversation history append-only; to save the request right now, send the beta header with "drop_block".

[1] Check whether your account and model are affected. The check exists only on Claude Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5. The official docs say accounts created on or after 2026-08-31 00:00 UTC are checked by default, while older accounts are checked only on requests that set prefix_mismatch_behavior. That is why the same code works on an old account and breaks only on a new one. The docs recommend building append-only regardless of account age.

[2] Read the end of the message to find what changed. The leading messages.{i}.content.{j} is the first failing block, and the message usually ends with a sentence naming what changed (system, the tools list, the first differing message). That sentence is for people and logs and its wording can change, so do not string-match it in code. First rule out two similar cases.

MessageCause
Stops after `Invalid signature in thinking block`The signature itself was truncated, altered or sent back empty. drop_block does not help
... cannot be modified. These blocks must remain as they were in the original response.The thinking block content was edited
Ends with `That setting requires the thinking-binding-controls-2026-08-01 value in the anthropic-beta header.`This case, sent without the beta header

[3] Find the code that edits the prefix. The common rows from the docs' "what counts as an edit" table:

Invalidates later blocksFine
Rebuilding the top-level system on each requestAppending messages at the end
Re-rendering date or environment info in the first user messageChanging effort, max_tokens, tool_choice, metadata
Clearing or shortening an old tool_result, re-encoding an old imageMoving cache_control markers
Adding, removing or renaming a tool in toolsServer-side compaction or context editing
Removing a thinking block from the middle and keeping later onesRemoving thinking blocks from the start, the end, or all of them
An image or document URL whose bytes changeA rotating signed URL returning the same bytes

Resending the same body fails the same way every time, so plain retries do not help.

[4] Replace each edit with an append. The replacements the docs pair with each edit:

  • Instead of changing system, add instructions with a mid-conversation system message.
  • Put changing context (date, environment) in the newest turn instead of editing the first message.
  • To clear old tool results, trim on the server (clear_tool_uses_20250919, beta context-management-2025-06-27). Shorten results before the first time you send them.
  • To change the tool list, use tool_addition and tool_removal blocks.
  • Send images and documents by Files API file_id or base64.

All of these assume you send assistant turns back exactly as returned, thinking blocks included (even ones with an empty thinking field). Mid-conversation system messages and tool changes are not available on every model, so check the docs' support list.

[5] If you must save the request now, use drop_block. Add the beta header and put block_binding in the thinking config.

console
$ curl https://api.anthropic.com/v1/messages \    -H "x-api-key: $ANTHROPIC_API_KEY" \    -H "anthropic-version: 2023-06-01" \    -H "anthropic-beta: thinking-binding-controls-2026-08-01" \    -H "content-type: application/json" \    -d '{"model": "claude-fable-5-1", "max_tokens": 16000,         "thinking": {"type": "adaptive", "block_binding": {"prefix_mismatch_behavior": "drop_block"}},         "messages": [...]}'

Sending block_binding without the header returns a 400 ending in block_binding: Extra inputs are not permitted. Add the header or remove the field. On Sonnet 5.5 and Haiku 5.5, block_binding works only with thinking: {"type": "adaptive"}; with between_tools on Sonnet 5.5 or disabled on Haiku 5.5, keep history append-only or strip thinking blocks from the edited turn on.

[6] If you cannot send the header, strip thinking blocks once. Remove every thinking and redacted_thinking block from the history (at minimum the named block and everything after it), leave the other blocks in place, and retry once. Do not put removed blocks back; restoring one invalidates the blocks produced while it was gone.

If you build a library or proxy, pass the caller's anthropic-beta values and block_binding through unchanged, and do not move a role: "system" message into the top-level system. For other thinking-related 400s, see Fix Claude API 400 "thinking.type.enabled is not supported".

#claude#api#thinking#troubleshooting