#12556·goose

Tool-result images are sent as an image-only user message; some OpenAI-compatible gateways ignore it

Author: Innsaute-glitchCreated Sep 28, 2026Updated Sep 28, 2026

Environment

  • goose v1.52.0 and main @ 98c626d
  • Custom/declarative OpenAI-engine provider (a generic OpenAI-compatible gateway)
  • Vision is correctly resolved (supports_vision = true); the image is present in the request.

Problem

When a tool result contains an image and the model is vision-capable, goose appends the image as a separate user message whose content is exclusively image_url (no text part), immediately after the tool message:

jsonc
{ "role": "tool", "content": "This tool result included an image that is uploaded in the next message.", "tool_call_id": "..." },
{ "role": "user", "content": [ { "type": "image_url", "image_url": { "url": "data:image/png;base64,..." } } ] }

On at least one OpenAI-compatible gateway this shape is not processed: the model either reports that no image arrived, or hallucinates unrelated content — even though the bytes are correct.

Evidence

goose's outgoing request was captured and replayed verbatim to the gateway (/v1/chat/completions, image byte-identical to the source file). A shape matrix was then run with the same image:

messages shape sent model behaviour
user: [text, image_url] ✅ correct description
user: [image_url] only ❌ hallucinated unrelated content
user: [image_url, text] ✅ correct description
tool → user: [text, image_url] ✅ correct description
tool → user: [image_url] only (goose's shape) ❌ "I don't see a file or image in our conversation"

Adding any text part to the same message makes it work, regardless of order.

Location

crates/goose-provider-types/src/formats/openai.rs, the MessageContentBlock::ToolResponse arm (around line 362):

rust
ContentBlock::Image(image) => {
    if options.supports_vision {
        tool_content.push(ContentBlock::text("This tool result included an image that is uploaded in the next message."));
        image_messages.push(json!({
            "role": "user",
            "content": [convert_image(&image.clone(), image_format)]   // image-only
        }));
    } else { ... }
}

Note is_image_only_user_message() (line ~653) already exists to recognise this synthetic message in merge_split_tool_call_messages (#12233), so goose is aware of the construct — but nothing accounts for gateways that reject image-only user messages.

Proposed fix

Give the synthesized image message a text part, and update is_image_only_user_message to keep matching it (it now carries a text part alongside image_url). Patch attached / see PR.

Alternatives considered

  • Provider-side fix (make gateways accept image-only messages): larger blast radius and not something goose can rely on.
  • Appending the image to the tool message instead: chat tool messages are string-only, so not possible; hence the synthetic user message.