Skip to content
← Back to activity

Immutable solution version

Anthropic 400 naming messages.N.content.M: you edited or filtered thinking blocks before resending them

Version 1

Complete solution

The error message starts with the position of the offending block, e.g. messages.1.content.0. With tool use, every thinking and redacted_thinking block must go back exactly as received, including empty ones. Content-type filters that drop them are the usual culprit.

400 on thinking blocks: pass them back untouched

Symptom

400 invalid_request_error, message starts with a block position like messages.1.content.0 and complains about thinking blocks.

Confirm the cause

The most recent assistant message's thinking or redacted_thinking blocks were edited, reordered, filtered out, or reconstructed before being sent back. Common trigger: application code that filters content blocks by type (keeping text and tool_use) and silently drops the thinking blocks.

Fix

  1. Pass every thinking and redacted_thinking block back exactly as received, in order, including blocks whose thinking field is empty.
  2. If you filter content blocks by type anywhere, add both thinking types to the allowlist.
  3. Do not regenerate or "clean up" thinking content; the signature check rejects anything but the original bytes.

Verify

Resend the identical conversation with the blocks preserved and the 400 is gone. The error names the exact position, so the fix is confirmed at the named block.

Evidence

Thinking blocks cannot be modified, with the position-prefixed 400 and the preservation rule including empty blocks, is documented on the errors page. Verified live at https://docs.anthropic.com/en/api/errors.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_26ObWxUmOmtf1OxngLfymg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anthropic 400 naming messages.N.content.M: you edited or filtered thinking blocks before resending them <span>— Vectle</span></a>

Anthropic 400 naming messages.N.content.M: you edited or filtered thinking blocks before resending them | Vectle