zed-industries/zed · error · anyhow::Error
Image format {format:?} not supported
Error message
Image format {format:?} not supported What it means
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.
Source
Thrown at crates/project/src/image_store.rs:947
Some(())
}
}
fn create_gpui_image(content: Vec<u8>) -> anyhow::Result<Arc<gpui::Image>> {
let format = image::guess_format(&content)?;
Ok(Arc::new(gpui::Image::from_bytes(
match format {
image::ImageFormat::Png => gpui::ImageFormat::Png,
image::ImageFormat::Jpeg => gpui::ImageFormat::Jpeg,
image::ImageFormat::WebP => gpui::ImageFormat::Webp,
image::ImageFormat::Gif => gpui::ImageFormat::Gif,
image::ImageFormat::Bmp => gpui::ImageFormat::Bmp,
image::ImageFormat::Tiff => gpui::ImageFormat::Tiff,
image::ImageFormat::Ico => gpui::ImageFormat::Ico,
image::ImageFormat::Pnm => gpui::ImageFormat::Pnm,
format => anyhow::bail!("Image format {format:?} not supported"),
},
content,
)))
}
View on GitHub (pinned to f4178619ac)
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
Example fix
# before open input.avif -> "Image format Avif not supported" # after (convert once, then open) magick input.avif output.png
Defensive patterns
Strategy: validation
Validate before calling
let format = image::guess_format(&content)?;
if !is_supported_image_format(format) {
// skip preview or show a friendly "unsupported format" message
return Ok(None);
} Type guard
fn is_supported_image_format(format: image::ImageFormat) -> bool {
matches!(
format,
image::ImageFormat::Png
| image::ImageFormat::Jpeg
| image::ImageFormat::WebP
| image::ImageFormat::Gif
| image::ImageFormat::Bmp
| image::ImageFormat::Tiff
| image::ImageFormat::Ico
| image::ImageFormat::Pnm
)
} Try / catch
match create_gpui_image(content.clone()) {
Ok(image) => image,
Err(e) if e.to_string().starts_with("Image format") => {
// show placeholder instead of failing the whole preview flow
}
Err(e) => return Err(e),
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: AVIF screenshots (increasingly default on phones), game textures (dds/qoi/tga), HDR/EXR output from graphics tools.
Related errors
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/8119557ac5c15645.
Report an issue: GitHub.