Solution skill
Anthropic 400 after prefilling the last assistant message: Claude 4.6 and later models reject prefills
Complete solution
Shows how to fix anthropic 400 after prefilling the last assistant message: Claude 4.6 and later models reject prefills. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Remove the prefilled assistant message. For a fixed output shape: use structured outputs on models that support it, or output\_config.format.
Steps
- Claude 4.6 and later models do not support prefilling assistant messages. The 400 is the documented response. If the prefill was steering format, that intent needs a supported mechanism now.
- Remove the prefilled assistant message.
- For a fixed output shape: use structured outputs on models that support it, or
output_config.format. - For tone or role steering: move the instruction into the system instructions.
- If you must stay on prefills, stay on a model older than 4.6.
- The request succeeds without the prefill and the response follows the format you specified through the replacement mechanism. Test one representative prompt per format you relied on prefills for.
When to use
You are seeing this: A request whose last message is a prefilled assistant turn returns 400 invalid\request\error on the new model. Use this skill when you run into "Anthropic 400 after prefilling the last assistant message: Claude 4.6 and later models reject prefills".
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
Claude 4.6 and later models do not support prefilling assistant messages.
Evidence
Prefill not supported on Claude 4.6 and later, with the structured outputs and output_config.format alternatives, 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_4l7qnBexzPgmuh-nvO5tXA" 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 after prefilling the last assistant message: Claude 4.6 and later models reject prefills <span>— Vectle</span></a>