zed-industries/zed · error

Attempted to read an image, but this model doesn't support i

Error message

Attempted to read an image, but this model doesn't support it.

What it means

When a tool result contains image content and the active model cannot accept images in tool results, the thread replaces image parts with a placeholder if any non-image content exists; if the output consists solely of images, the result is converted into this error. It prevents sending an unsupported image-only payload to the model.

Source

Thrown at crates/agent/src/thread.rs:3646

                        let placeholder = LanguageModelToolResultContent::Text(Arc::from(
                            "[Tool responded with an image, but this model doesn't support images]",
                        ));
                        let has_non_image = output
                            .llm_output
                            .iter()
                            .any(|part| !matches!(part, LanguageModelToolResultContent::Image(_)));
                        if has_non_image {
                            output.llm_output = output
                                .llm_output
                                .into_iter()
                                .map(|part| match part {
                                    LanguageModelToolResultContent::Image(_) => placeholder.clone(),
                                    other => other,
                                })
                                .collect();
                            (false, output)
                        } else {
                            let output = anyhow::anyhow!(
                                "Attempted to read an image, but this model doesn't support it.",
                            )
                            .into();
                            (true, output)
                        }
                    } else {
                        (false, output)
                    }
                }
                Err(output) => (true, output),
            };

            (
                owning_message_ix,
                LanguageModelToolResult {
                    tool_use_id,
                    tool_name,
                    is_error,

View on GitHub (pinned to bc538def45)

Solutions

  1. Switch the thread to a model that supports image input and resend
  2. Make the tool return textual context (dimensions, path, OCR text) alongside or instead of the raw image
  3. Restrict image-returning tools so they are only offered to image-capable models
  4. Handle the error as a tool outcome and let the agent continue with a textual explanation

Example fix

// before: tool returns only an image
Ok(vec![LanguageModelToolResultContent::Image(image)])

// after: always pair the image with text so non-vision models keep working
Ok(vec![
    LanguageModelToolResultContent::Text(format!("image {}x{} at {}", width, height, path)),
    LanguageModelToolResultContent::Image(image),
])
Defensive patterns

Strategy: validation

Validate before calling

// In the tool: avoid returning image-only output when the model lacks vision.
fn safe_output(
    output: Vec<LanguageModelToolResultContent>,
    model_supports_images: bool,
) -> Vec<LanguageModelToolResultContent> {
    if model_supports_images {
        return output;
    }
    output
        .into_iter()
        .map(|part| match part {
            LanguageModelToolResultContent::Image(_) => {
                LanguageModelToolResultContent::Text("[image omitted]".into())
            }
            other => other,
        })
        .collect()
}

Type guard

fn is_image_only_output(output: &ToolRpcOutput) -> bool {
    !output.llm_output.is_empty()
        && output
            .llm_output
            .iter()
            .all(|part| matches!(part, LanguageModelToolResultContent::Image(_)))
}

Try / catch

match tool_result {
    Err(err) if err.to_string().starts_with("Attempted to read an image") => {
        // Degrade gracefully: tell the agent the model cannot see images.
        report_to_model("This model cannot view images; describe them in text instead.");
    }
    other => other,
}

Prevention

When it happens

Trigger: A tool whose output is only LanguageModelToolResultContent::Image parts (for example reading or capturing an image) runs while the turn's model has no image input support, or an errored tool output carried image-only content.

Common situations: Using image-reading or screenshot tools with a text-only model; the model being switched mid-session to one without vision; a subagent configured with a text-only model invoking an image tool.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/ef7d64ce5119a27f. Report an issue: GitHub.