What happens if you send a Claude API request where the messages array starts with an 'assistant' role message?
Select an answer to reveal the explanation.
Short Explanation and Infographic
The Claude API requires conversations to start with a user turn — assistant messages can only appear after user messages in alternating fashion.
Full explanation below image
Full Explanation
The Anthropic Messages API enforces a specific structure: the first message in the messages array must have role='user', and roles must alternate (user, assistant, user, assistant...). Attempting to start with an assistant message results in a 400 validation error. This mirrors natural conversation flow where a user initiates and Claude responds. Option A is wrong — roles are not interchangeable. Option C is wrong — the API doesn't auto-insert messages. Option D is wrong — the API returns an error, it doesn't silently skip messages.