{"record":{"id":"8119557ac5c15645","repo":"zed-industries/zed","slug":"image-format-format-not-supported","errorCode":null,"errorMessage":"Image format {format:?} not supported","messagePattern":"Image format (.+?) not supported","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/project/src/image_store.rs","lineNumber":947,"sourceCode":"\n        Some(())\n    }\n}\n\nfn create_gpui_image(content: Vec<u8>) -> anyhow::Result<Arc<gpui::Image>> {\n    let format = image::guess_format(&content)?;\n\n    Ok(Arc::new(gpui::Image::from_bytes(\n        match format {\n            image::ImageFormat::Png => gpui::ImageFormat::Png,\n            image::ImageFormat::Jpeg => gpui::ImageFormat::Jpeg,\n            image::ImageFormat::WebP => gpui::ImageFormat::Webp,\n            image::ImageFormat::Gif => gpui::ImageFormat::Gif,\n            image::ImageFormat::Bmp => gpui::ImageFormat::Bmp,\n            image::ImageFormat::Tiff => gpui::ImageFormat::Tiff,\n            image::ImageFormat::Ico => gpui::ImageFormat::Ico,\n            image::ImageFormat::Pnm => gpui::ImageFormat::Pnm,\n            format => anyhow::bail!(\"Image format {format:?} not supported\"),\n        },\n        content,\n    )))\n}\n","sourceCodeStart":929,"sourceCodeEnd":952,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/project/src/image_store.rs#L929-L952","documentation":"ImageStore builds previews via create_gpui_image (crates/project/src/image_store.rs:934): image::guess_format sniffs the bytes, then the detected format is mapped onto a gpui::ImageFormat. Only Png, Jpeg, WebP, Gif, Bmp, Tiff, Ico and Pnm are mapped; every other format the image crate can detect (Avif, Tga, Dds, OpenExr, Qoi, Farbfeld, Hdr, ...) falls into the catch-all arm and bails.","triggerScenarios":"Opening an image file whose detected format is not one of the eight supported ones - e.g. .avif, .tga, .dds, .exr, .qoi, .ff/.farbfeld, .hdr - in Zed's image preview.","commonSituations":"AVIF screenshots (increasingly default on phones), game textures (dds/qoi/tga), HDR/EXR output from graphics tools.","solutions":["Convert the file to a supported format: magick input.avif output.png","Re-export from the source tool as PNG/JPEG/WebP/GIF/BMP/TIFF/ICO/PNM","Watch or upvote upstream gpui support for the format instead of patching around it"],"exampleFix":"# before\nopen input.avif  ->  \"Image format Avif not supported\"\n\n# after (convert once, then open)\nmagick input.avif output.png","handlingStrategy":"validation","validationCode":"let format = image::guess_format(&content)?;\nif !is_supported_image_format(format) {\n    // skip preview or show a friendly \"unsupported format\" message\n    return Ok(None);\n}","typeGuard":"fn is_supported_image_format(format: image::ImageFormat) -> bool {\n    matches!(\n        format,\n        image::ImageFormat::Png\n            | image::ImageFormat::Jpeg\n            | image::ImageFormat::WebP\n            | image::ImageFormat::Gif\n            | image::ImageFormat::Bmp\n            | image::ImageFormat::Tiff\n            | image::ImageFormat::Ico\n            | image::ImageFormat::Pnm\n    )\n}","tryCatchPattern":"match create_gpui_image(content.clone()) {\n    Ok(image) => image,\n    Err(e) if e.to_string().starts_with(\"Image format\") => {\n        // show placeholder instead of failing the whole preview flow\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Whitelist formats before requesting a preview instead of relying on the decode error","Convert AVIF/TGA/DDS/EXR/QOI/HDR assets to PNG at ingest time"],"tags":["image","format","preview","unsupported-format"],"backgroundTag":"unsupported-image-format","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"}