anomalyco / anomalyco/opencode

Bedrock: tool-result images rejected for all non-Anthropic/Nova models

Open
#49,443 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 17, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Bedrock Converse rejects images inside toolResult for most non-Anthropic models, but OpenCode keeps tool-result images in place for every @ai-sdk/amazon-bedrock model. After any tool returns an image (read on a PNG, a screenshot MCP tool), every following request in the session fails with:

This model doesn't support the image field for user messages. Remove image and try again.

This is documented AWS behavior, not a model quirk. The Converse API reference for ToolResultContentBlock.image says: "This field is only supported by Amazon Nova and Anthropic Claude 3 and 4 models."
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolResultContentBlock.html

#48069 reports this for GPT-6 Astra and #48070 fixes Astra by model ID. The problem is wider. I ran the same 4x4 PNG through bedrock-runtime converse in us-east-1, once as a user-level image block and once inside toolResult.content:

Model User-level image Image in toolResult
anthropic.claude-sonnet-4-6, claude-opus-4-8 200 200
amazon.nova-pro-v1:0, nova-2-lite-v1:0 200 200
meta.llama4-maverick-17b-instruct-v1:0 200 200 (not on the documented list)
openai.gpt-6-astra, gpt-5.6-sol, gpt-5.6-luna, gpt-5.6-terra 200 400
mistral.pixtral-large-2502-v1:0, mistral-large-3-675b-instruct 200 400
qwen.qwen3-vl-235b-a22b 200 400
google.gemma-3-27b-it 200 400
moonshotai.kimi-k2.5 200 400
xai.grok-4.6 500 400

supportsMediaInToolResult in packages/opencode/src/session/message-v2.ts returns true for images on any @ai-sdk/amazon-bedrock model. The existing hoist path (move the image into a synthetic user message after the tool result) works on every model in the table, so the safe default is to hoist and only keep images in the tool result for the documented Anthropic and Nova IDs.

Plugins

Reproduced with --pure.

OpenCode version

1.18.31, and dev at 88c6c7abc7.

Steps to reproduce
  1. Configure Amazon Bedrock with any non-Anthropic image model, e.g. global.openai.gpt-5.6-sol or us.mistral.pixtral-large-2502-v1:0.
  2. opencode run --pure --model amazon-bedrock/global.openai.gpt-5.6-sol "Use the read tool on ./red.png, then answer with the dominant color in one word."
  3. The read tool completes; the next model request fails with the error above. The same command against amazon-bedrock/us.anthropic.claude-sonnet-4-6 answers "Red".
Screenshot and/or share link

No response

Operating System

macOS 15

Terminal

Ghostty

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.