← ClaudeAtlas

openrouter-assistant-prefill-host-rejectionlisted

Diagnose and fix "This model does not support assistant message prefill. The conversation must end with a user message." errors when running Anthropic models through OpenRouter (opencode, agent harnesses, any client that sometimes ends a request on an assistant turn). Use when: (1) that exact error kills a run, branded [Azure], [Amazon Bedrock], [Google], or [Anthropic]; (2) the failure is intermittent across otherwise-identical runs; (3) a provider routing pin "fixed" it and it came back. Covers why pins cannot fix it, why intermittent green runs prove nothing, the behavioral probe that actually tests a candidate model, and the model-family change that resolves it.
MrBinnacle/skills · ★ 0 · AI & Automation · score 68
Install: claude install-skill MrBinnacle/skills
# OpenRouter Assistant-Prefill Host Rejection ## Problem A client (observed: opencode driving an agent loop) sometimes sends a request whose `messages` array ends on an `assistant` turn — assistant prefill. OpenRouter hosts serving Anthropic models reject that shape with: ``` This model does not support assistant message prefill. The conversation must end with a user message. ``` The run dies mid-conversation. Because the client only produces the prefill shape on SOME turns (continuation after truncation, certain compaction states), the failure is intermittent, which invites two wrong fixes: retrying, and pinning providers. ## Context / Trigger Conditions - The exact error above, prefixed with a host name: `[Azure]`, `[Amazon Bedrock]`, `[Google]` (Vertex), or `[Anthropic]`. - Model id is an Anthropic model via OpenRouter (`openrouter/anthropic/...`). - Same pipeline succeeded on other runs with no config change. - A `provider.only` / `provider.ignore` routing pin was added and the error recurred from a different (or eventually the same) host. ## Why the obvious fixes fail (measured, one project, 4 host families) 1. **Ignore-listing the failing host** grows one corpse at a time: Azure, then "Claude Platform on AWS", then Anthropic first-party each rejected identically. 2. **Positively pinning the one host not yet observed rejecting** (Vertex) held for two runs, then rejected too. The green runs were conversation-shape luck — those conversations never happ