Claude API 400: This model does not support assistant message prefill

Claude returns 400 invalid_request_error about assistant message prefill? Newer Claude models reject a conversation that ends with an assistant message.

Reviewed October 25, 2026

What it means in plain English

Anthropic's Claude API errors page says Claude 4.6 and later models, and Claude Mythos Preview, do not support prefilling assistant messages. A request whose last message is a prefilled assistant message returns a 400 invalid_request_error with this message:

This model does not support assistant message prefill. The conversation must end with a user message.

Prefill means your code sends the start of Claude's answer as the last message in the conversation. A request that worked on an older model fails with this error once you switch it to one of these models.

Likely causes

  • The messages array ends with a message whose role is assistant.
  • You upgraded the model name in an app that used prefill to force a format, such as JSON.

How to fix it, step by step

  1. Find where your server builds the messages array for the Claude API.
  2. Make sure the last message has role: "user". Remove the trailing assistant message that holds the prefill.
  3. Replace what the prefill was doing. Anthropic suggests structured outputs on models that support it, system prompt instructions, or output_config.format.
  4. Catch the SDK's typed error rather than matching the message text. Anthropic says to catch the SDK's typed classes rather than string-matching error messages.
  5. Redeploy and send a test request.

How to check it worked

  • The same request returns a normal response instead of a 400.
  • Output that relied on the prefill, such as JSON, still comes back in the format you need.

Sources

More AI API errors fixes

Keep going on your own.

The guides stay free. A deep leak report is $15. Fix packs are $24, or $49 for all three. There is no done-for-you repair.

See products