{"record":{"id":"49e0ff95468e4f86","repo":"zed-industries/zed","slug":"unsupported-image-mime-type","errorCode":null,"errorMessage":"unsupported image MIME type `{}`","messagePattern":"unsupported image MIME type `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/language_model/src/request.rs","lineNumber":61,"sourceCode":"                ImageFormat::Webp => image::ImageFormat::WebP,\n                ImageFormat::Gif => image::ImageFormat::Gif,\n                ImageFormat::Bmp => image::ImageFormat::Bmp,\n                ImageFormat::Tiff => image::ImageFormat::Tiff,\n                ImageFormat::Ico => image::ImageFormat::Ico,\n                ImageFormat::Pnm => image::ImageFormat::Pnm,\n                ImageFormat::Svg => return None,\n            };\n            let dynamic_image =\n                image::load_from_memory_with_format(data.bytes(), format).log_err()?;\n            language_model_image_from_dynamic_image(dynamic_image)\n                .log_err()\n                .flatten()\n        })\n    }\n\n    fn from_base64_image(data: &str, mime_type: &str) -> Result<Option<LanguageModelImage>> {\n        let format = image::ImageFormat::from_mime_type(mime_type)\n            .ok_or_else(|| anyhow!(\"unsupported image MIME type `{}`\", mime_type))?;\n        let bytes = base64::engine::general_purpose::STANDARD.decode(data.as_bytes())?;\n        let dynamic_image = image::load_from_memory_with_format(&bytes, format)?;\n        language_model_image_from_dynamic_image(dynamic_image)\n    }\n}\n\nfn language_model_image_from_dynamic_image(\n    dynamic_image: image::DynamicImage,\n) -> Result<Option<LanguageModelImage>> {\n    let width = dynamic_image.width();\n    let height = dynamic_image.height();\n    let image_size = size(DevicePixels(width as i32), DevicePixels(height as i32));\n\n    // First apply any provider-specific dimension constraints we know about (Anthropic).\n    let mut processed_image = if image_size.width.0 > ANTHROPIC_SIZE_LIMIT as i32\n        || image_size.height.0 > ANTHROPIC_SIZE_LIMIT as i32\n    {\n        let new_bounds = ObjectFit::ScaleDown.get_bounds(","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/language_model/src/request.rs#L43-L79","documentation":"Validation in LanguageModelImage::from_base64_image: the supplied MIME type string is not one the `image` crate recognizes (image::ImageFormat::from_mime_type failed), so the base64 payload cannot be decoded into a model image. The image attachment's MIME type is missing, malformed, or an unsupported type (e.g. SVG or text).","triggerScenarios":"Thrown at crates/language_model/src/request.rs:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the image attachment carries a standard MIME type such as image/png, image/jpeg, image/webp, or image/gif","Strip parameters/whitespace from the MIME string if present (from_mime_type expects a bare type)","Convert unsupported formats (e.g. SVG) to PNG before attaching","Validate the MIME type at ingestion instead of at send time"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}