Skip to content

BUG: Validation error and extraction for Anthropic system messages #219

Description

@balraam1

Kiro Gateway Version

latest

What happened?

When using the Anthropic API and providing messages with the "system" role in the messages array, the gateway raises a 422 Validation Error (Input should be 'user' or 'assistant') and fails.

The gateway should allow system messages in the messages array for Anthropic, extract them, and merge them with the main system_prompt properly without triggering validation errors.

Debug Logs

2026-06-04 11:36:20 | ERROR | kiro.exceptions:validation_exception_handler:88 - Validation error (422): [{'type': 'literal_error', 'loc': ['body', 'messages', 1, 'role'], 'msg': "Input should be 'user' or 'assistant'", 'input': 'system', 'ctx': {'expected': "'user' or 'assistant'"}}]

(Note: No files from debug_logs/ are attached because the request failed at Pydantic validation before reaching Kiro, so no debug logs were generated.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions