Skip to content

Claude API 400 "This model does not support assistant message prefill" — Causes and Fixes ​

A request to /v1/messages fails with HTTP 400 invalid_request_error because the conversation history includes an assistant message at the very end of the messages array, which is commonly used to "prefill" the model's response.

Short answer

"This model does not support assistant message prefill" means your API request ends with an assistant role message. Claude 4.6 and later models (including all 5.5 versions) require the conversation to end with a user message. Remove the trailing assistant message and use official methods like output_config.format or system instructions to guide the model's output.

Last verified: 2026-11-14 (source: Anthropic API Errors).

Symptoms and What the Error Means ​

When you attempt to force the start of the model's response by adding a final assistant turn—a technique often used to force JSON output or a specific starting phrase—the API rejects the request before generation begins.

The API returns exactly this error body:

json
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "This model does not support assistant message prefill. The conversation must end with a user message."
  }
}

Models Affected ​

The prefill restriction applies to the following model versions:

ModelAssistant prefill
Claude Opus 5.5Not supported (400)
Claude Sonnet 5.5Not supported (400)
Claude Haiku 5.5Not supported (400)
Claude 4.6 and laterNot supported (400)
Claude Mythos PreviewNot supported (400)

Why It Happens ​

  1. Forcing JSON: You are sending {"role": "assistant", "content": "{"} to force the model to start its output with an opening brace.
  2. Continue from here: You are passing the last part of a previous generation as an assistant message to make the model "continue" exactly where it left off.
  3. Forcing a prefix: You are prepending text to the assistant turn to ensure the response starts with a specific word or format.

Fix 1: Remove the Assistant Message and Use Structured Output ​

If your goal is to generate JSON, do not prefill. Instead, use the output_config parameter to define the expected schema.

Failing Request (Don't do this):

json
{
  "model": "claude-sonnet-5-5",
  "max_tokens": 1024,
  "messages": [
    {"role": "user", "content": "List three colors."},
    {"role": "assistant", "content": "{"}
  ]
}

Fixed Request:

json
{
  "model": "claude-sonnet-5-5",
  "max_tokens": 1024,
  "output_config": {
    "format": {
      "type": "json_schema",
      "schema": {
        "type": "object",
        "properties": {
          "colors": {"type": "array", "items": {"type": "string"}}
        }
      }
    }
  },
  "messages": [
    {"role": "user", "content": "List three colors."}
  ]
}

Fix 2: Use System Prompts for Style ​

If you used prefill to force a specific style or tone (e.g., forcing the model to start with "Certainly!"), move that instruction into the system block.

Fixed Request:

json
{
  "model": "claude-opus-5-5",
  "max_tokens": 1024,
  "system": "Always start your response with 'Certainly!' and provide the requested information.",
  "messages": [
    {"role": "user", "content": "Tell me a fact about space."}
  ]
}

Through a gateway ​

When you call an API through a gateway, this error originates from the upstream API's validation logic. The gateway passes this rejection back to you exactly as received. If you are using a library or proxy that automatically attempts to manage conversation state or injects "continue" tokens, check the actual JSON request body being sent to ensure no assistant message exists at the end of the messages array. The fix is to modify your request structure to adhere to the model's requirement that the user message must be the final turn.

FAQ ​

Why does my request fail with the prefill error? ​

Claude 4.6 and later models, including the 5.5 series, do not support assistant message prefill. If your request ends with an assistant message intended to force the start of the reply, the API returns an invalid_request_error.

What models are affected by the prefill restriction? ​

All Claude 4.6 and later models, as well as the Claude Mythos Preview, reject assistant message prefill. You must ensure the messages array ends with a user message.

How do I force JSON output without prefill? ​

Instead of prefilling with an opening brace, use output_config.format with type json_schema to enforce the response structure. This is the supported method for generating structured output on current models.

How can I control the style or start of the reply? ​

Use system prompt instructions to define the desired tone, style, or output format.

Got a problem? Contact support or join our group.