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
The Bedrock request builder collects image URLs found in user messages that are network URLs (http/https) rather than base64 data. Since Bedrock's InvokeModel API requires images to be passed inline as base64 content, network-hosted image URLs cannot be forwarded, so the builder fails before any request is sent.
Solutions
- Download the image, base64-encode it, and pass it as inline data (ImageMediaType with decoded data) instead of a URL
- Preprocess messages to convert network image URLs to base64 before calling the client
- Use a provider that supports URL images (e.g. OpenAI) if inline images are not feasible
- Strip image content from messages when targeting Bedrock models
Example fix
// before
UserContent::Image(ImageUrl::Url("https://example.com/cat.png".into()))
// after
let bytes = reqwest::get(url).await?.bytes().await?;
UserContent::Image(ImageUrl::Decode(String::from("png"), base64::encode(bytes))) Defensive patterns
Strategy: validation
Validate before calling
let network_imgs: Vec<_> = messages.iter()
.flat_map(|m| m.images())
.filter(|img| img.url().map_or(false, |u| u.starts_with("http")))
.collect();
if !network_imgs.is_empty() {
// download + base64-encode before sending
} Type guard
fn is_network_image(img: &Image) -> bool {
matches!(img, Image::Url(u) if u.starts_with("http"))
} Prevention
- Always convert remote image URLs to base64 inline data for Bedrock
- Build a preprocessing step in the message pipeline
- Add a unit test that rejects http image URLs for Bedrock targets
- Prefer providers that accept URL images when URLs are required
When it happens
Trigger: build_chat_completions_body (via chat_completions_builder) finds a non-empty network_image_urls list — i.e. a UserContent message contains an image whose source is a remote URL instead of embedded base64 data.
Common situations: Passing image URLs scraped from the web directly in chat messages, forgetting to download and base64-encode images before calling Bedrock-backed models, or porting code written for OpenAI (which accepts URLs) to Bedrock.
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
- Invalid response data
- Unrecognized message, message_type
- The client doesn't support embeddings api
AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09).
Data as JSON: /api/errors/055f3435b91b8fe5.
Report an issue: GitHub.
Appendix: source
Thrown at src/client/bedrock.rs:431
}));
}
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!({
"inferenceConfig": {},
"messages": messages,
});
if let Some(v) = system_message {
body["system"] = json!([
{
"text": v,
}
])
}
if let Some(v) = model.max_tokens_param() {View on GitHub (pinned to 82976d349a)