sigoden/aichat · error
The model does not support network images
Error message
The model does not support network images: {network_image_urls:?} What it means
Identical guard to the Bedrock one, but in the Claude (Anthropic API) client's body builder: claude_build_chat_completions_body collects network image URLs from messages and, because the Anthropic Messages API also requires images as base64 source blocks rather than remote URLs, fails fast with the list of offending URLs.
Solutions
- Download each image and supply it as base64-encoded source data in the message content
- Preprocess the prompt to inline image bytes before calling the client
- Route URL-image workloads to a provider that supports them (e.g. OpenAI vision)
- Remove image content if the Claude model does not need it
Example fix
// before
{ "type": "image", "url": "https://example.com/img.jpg" }
// after
let b64 = base64::encode(download("https://example.com/img.jpg").await?);
{ "type": "image", "source": { "type": "base64", "media_type": "image/jpeg", "data": b64 } } Defensive patterns
Strategy: validation
Validate before calling
for img in message_images {
if img.is_url() {
let bytes = download(img.url()).await?;
img.to_base64(bytes)?; // convert before send
}
} Type guard
fn is_url_image(img: &Image) -> bool {
matches!(img, Image::Url(u) if u.starts_with("http"))
} Prevention
- Base64-encode all images before Anthropic API calls
- Preprocess messages in one place so no URL image leaks through
- Test prompts containing images against the Anthropic client in CI
- Strip images when targeting models/modes that don't need them
When it happens
Trigger: prepare_chat_completions -> claude_build_chat_completions_body encounters user messages containing images referenced by http(s) URL rather than base64-decoded image data, making network_image_urls non-empty.
Common situations: Using image URLs in prompts against an Anthropic-backed client, code migrated from providers that accept URL images, or pipelines that never download/encode the images.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- The model does not support network images
- Invalid response data
- The client doesn't support embeddings api
- The client doesn't support rerank api
- The model does not support network images
AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09).
Data as JSON: /api/errors/9b17cd31e86b5db9.
Report an issue: GitHub.
Appendix: source
Thrown at src/client/claude.rs:260
}));
}
vec![
json!({
"role": "assistant",
"content": assistant_parts,
}),
json!({
"role": "user",
"content": user_parts,
}),
]
}
}
})
.collect();
if !network_image_urls.is_empty() {
bail!(
"The model does not support network images: {:?}",
network_image_urls
);
}
let mut body = json!({
"model": model.real_name(),
"messages": messages,
});
if let Some(v) = system_message {
body["system"] = v.into();
}
if let Some(v) = model.max_tokens_param() {
body["max_tokens"] = v.into();
}
if let Some(v) = temperature {
body["temperature"] = v.into();
}View on GitHub (pinned to 82976d349a)