AI EngineerGuide

Assistant message prefill returns a 400 on Claude Sonnet 5.5

Returns 400 Applies to claude-sonnet-5-5 on the Anthropic Messages API.

Error message, quoted from Anthropic's docs:

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

How to fix it

End the conversation with a user message. Use structured outputs for output format, the system prompt for preambles, and the user turn for continuations.

Before
{
  "max_tokens": 1024,
  "messages": [
    {
      "content": "Summarize this ticket.",
      "role": "user"
    },
    {
      "content": "{",
      "role": "assistant"
    }
  ],
  "model": "claude-sonnet-4-5-20250929"
}
After (Claude Sonnet 5.5)
{
  "max_tokens": 1024,
  "messages": [
    {
      "content": "Summarize this ticket.",
      "role": "user"
    }
  ],
  "model": "claude-sonnet-5-5"
}

Official source

Claude Sonnet 5.5 rejects a prefilled last assistant turn with a 400 error

https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide#migrating-from-sonnet-45 (last checked 2026-11-02)

Other changes for the same models

All migration errors

FAQ

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

Assistant message prefill returns a 400 on Claude Sonnet 5.5 The fix: End the conversation with a user message. Use structured outputs for output format, the system prompt for preambles, and the user turn for continuations.

How do I fix this when moving to claude-sonnet-5-5?

End the conversation with a user message. Use structured outputs for output format, the system prompt for preambles, and the user turn for continuations.

Where is this documented?

In Anthropic’s official docs: https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide#migrating-from-sonnet-45, last checked 2026-11-02.