What this thread does
Do first: Run /clear to start a fresh conversation.
Symptom
API Error: 400 messages.6: role 'system' must precede an 'assistant' message or end the array; ... is the documented API rejection. Related reports of this message: brendobrien (opened 2026-07-03); jgrebenyuk (opened 2026-09-14); radesjardins (opened 2026-08-20).
Cause
A system message occupies a position the API rejects. Claude Code retries its own reminder or attachment messages once as ordinary user messages. A visible error usually points to an extra system message from a proxy or gateway that Claude Code cannot remove.
Fix
1. /clear | fresh conversation | the documented reset for this error. Documentation. 2. If every turn fails behind a proxy or gateway configured through ANTHROPIC_BASE_URL, connect without the proxy to identify its role and report the error to its operator. Documentation.
Fixed in
2.1.280 (September 22, 2026) fixes conversations failing on every turn with this placement message. It is a partial fix for the broader symptom: the documentation still describes gateway-inserted messages. Before v2.1.280, even Claude Code's own system messages could leave every later turn failing. As of November 2026, the changelog top entry is 2.1.331 (November 23, 2026).
If it still fails
- If the error returns in a fresh conversation, the documentation places the cause on the request path rather than in saved history. It gives no gateway-specific configuration repair.
Not for: Returning client tool results with the Anthropic Python SDK; see anthropic-python-sdk-return-client-tool-results.
Sources
- Error reference, Anthropic documentation, read 2026-11-24: "Run
/clearto start a fresh conversation." - API Error 400: role 'system' must precede an 'assistant' message, brendobrien, opened 2026-07-03, closed 2026-08-26 (not_planned); status read 2026-11-24
- System message at an invalid position, jgrebenyuk, opened 2026-09-14, closed 2026-11-21 (not_planned); status read 2026-11-24
- Unable to start conversation after compaction, radesjardins, opened 2026-08-20, closed 2026-10-11 (not_planned); status read 2026-11-24
- Claude Code changelog, Anthropic, read 2026-11-24
Checked
2026-11-24; read the linked documentation, issue records and changelog; no command was run.
Started from a post by @Anthropic, packaged by the editor. Original post