mirror of
https://github.com/jwadow/kiro-gateway.git
synced 2026-04-25 01:15:57 +03:00
[GH-ISSUE #30] BUG: 422 Validation Error: Unsupported 'image' content block in messages #19
Labels
No labels
bug
bug
enhancement
enhancement
fixed
fixed
invalid
needs-info
needs-testing
pull-request
question
upstream
wontfix
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/kiro-gateway-jwadow#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @smileheart0708 on GitHub (Jan 10, 2026).
Original GitHub issue: https://github.com/jwadow/kiro-gateway/issues/30
Kiro Gateway Version
v2.0-rc.1
What happened?
Summary:
The gateway returns a 422 Unprocessable Entity error when a request contains an image content block in the messages.
Steps to Reproduce:
Send a request to the /v1/messages endpoint.
{ "type": "literal_error", "loc": ["body", "messages", 0, "content", 4, "TextContentBlock", "type"], "msg": "Input should be 'text'", "input": "image", "ctx": {"expected": "'text'"} } Expected Behavior: The gateway should support image content blocks as per the Anthropic Messages API specification, or at least handle them without a 422 validation crash.Include an image in the message content (e.g., via copy-pasting an image in the chat or sending a base64 image block).
Actual Result:
The request fails with a validation error because the backend models do not recognize the image type. The error log shows that the validator expects a text block but receives an image block:
Debug Logs
Summary:
The gateway returns a 422 Unprocessable Entity error when a request contains an image content block in the messages.
Steps to Reproduce:
Send a request to the /v1/messages endpoint.
{ "type": "literal_error", "loc": ["body", "messages", 0, "content", 4, "TextContentBlock", "type"], "msg": "Input should be 'text'", "input": "image", "ctx": {"expected": "'text'"} } Expected Behavior: The gateway should support image content blocks as per the Anthropic Messages API specification, or at least handle them without a 422 validation crash.Include an image in the message content (e.g., via copy-pasting an image in the chat or sending a base64 image block).
Actual Result:
The request fails with a validation error because the backend models do not recognize the image type. The error log shows that the validator expects a text block but receives an image block:
@jwadow commented on GitHub (Jan 10, 2026):
Fixed! The 422 error was happening because the Pydantic models didn't have ImageContentBlock defined. Now images are properly validated and forwarded to Kiro API.
Shoutout to @cniu6 who submitted PR #26 yesterday with a similar fix - I had to close it due to some security concerns (verify=False in http client) but the image support architecture was solid and inspired this implementation. Added them to CONTRIBUTORS.md.
One thing to note though - while the gateway now correctly sends images to Kiro in the right format, the actual vision capability seems to depend on the Kiro backend. In my testing images go through without errors but the model doesn't seem to actually see them. That's on their end, not something we can fix here. Although everything is possible.