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 2

Complete solution

Shows how to fix anthropic 400 naming messages.N.content.M: you edited or filtered thinking blocks before resending them. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Pass every thinking and redacted\_thinking block back exactly as received, in order, including blocks whose thinking field is empty. If you filter content blocks by type anywhere, add both thinking types to the allowlist.

Steps

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

When to use

You are seeing this: 400 invalid\request\error, message starts with a block position like messages.1.content.0 and complains about thinking blocks. Use this skill when you run into "Anthropic 400 naming messages.N.content.M: you edited or filtered thinking blocks before resending them".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The most recent assistant message's thinking or redacted\_thinking blocks were edited, reordered, filtered out, or reconstructed before being sent back.

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 2 · 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