{"record":{"id":"9b17cd31e86b5db9","repo":"sigoden/aichat","slug":"the-model-does-not-support-network-images-networ-9b17cd","errorCode":null,"errorMessage":"The model does not support network images: {network_image_urls:?}","messagePattern":"The model does not support network images: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/client/claude.rs","lineNumber":260,"sourceCode":"                        }));\n                    }\n                    vec![\n                        json!({\n                            \"role\": \"assistant\",\n                            \"content\": assistant_parts,\n                        }),\n                        json!({\n                            \"role\": \"user\",\n                            \"content\": user_parts,\n                        }),\n                    ]\n                }\n            }\n        })\n        .collect();\n\n    if !network_image_urls.is_empty() {\n        bail!(\n            \"The model does not support network images: {:?}\",\n            network_image_urls\n        );\n    }\n\n    let mut body = json!({\n        \"model\": model.real_name(),\n        \"messages\": messages,\n    });\n    if let Some(v) = system_message {\n        body[\"system\"] = v.into();\n    }\n    if let Some(v) = model.max_tokens_param() {\n        body[\"max_tokens\"] = v.into();\n    }\n    if let Some(v) = temperature {\n        body[\"temperature\"] = v.into();\n    }","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/client/claude.rs#L242-L278","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n{ \"type\": \"image\", \"url\": \"https://example.com/img.jpg\" }\n// after\nlet b64 = base64::encode(download(\"https://example.com/img.jpg\").await?);\n{ \"type\": \"image\", \"source\": { \"type\": \"base64\", \"media_type\": \"image/jpeg\", \"data\": b64 } }","handlingStrategy":"validation","validationCode":"for img in message_images {\n    if img.is_url() {\n        let bytes = download(img.url()).await?;\n        img.to_base64(bytes)?; // convert before send\n    }\n}","typeGuard":"fn is_url_image(img: &Image) -> bool {\n    matches!(img, Image::Url(u) if u.starts_with(\"http\"))\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["claude","anthropic","images","unsupported-feature","request-validation"],"backgroundTag":"unsupported-operation","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}