zed-industries/zed · error · anyhow::Error

unsupported image format {format:?}

Error message

unsupported image format {format:?}

What it means

Raised in the image Output::from conversion when the decoded image's format enum value does not map to one of the GPUI-supported formats (Png, Jpeg, Gif, WebP, Tiff, Bmp, ...). The unrecognized format discriminant is the fault; the MIME type advertised by the kernel does not match a format Zed can render.

Source

Thrown at crates/repl/src/outputs/image.rs:58

        for pixel in data.chunks_exact_mut(4) {
            pixel.swap(0, 2);
        }

        let height = data.height();
        let width = data.width();

        let gpui_image_data = RenderImage::new(vec![image::Frame::new(data)]);

        let format = match format {
            image::ImageFormat::Png => ImageFormat::Png,
            image::ImageFormat::Jpeg => ImageFormat::Jpeg,
            image::ImageFormat::Gif => ImageFormat::Gif,
            image::ImageFormat::WebP => ImageFormat::Webp,
            image::ImageFormat::Tiff => ImageFormat::Tiff,
            image::ImageFormat::Bmp => ImageFormat::Bmp,
            image::ImageFormat::Ico => ImageFormat::Ico,
            format => {
                anyhow::bail!("unsupported image format {format:?}");
            }
        };

        // Convert back to a GPUI image for use with the clipboard
        let clipboard_image = Arc::new(Image::from_bytes(format, bytes));

        Ok(ImageView {
            clipboard_image,
            height,
            width,
            image: Arc::new(gpui_image_data),
        })
    }

    fn scaled_size(
        &self,
        line_height: Pixels,
        max_width: Option<Pixels>,

View on GitHub (pinned to f4178619ac)

Solutions

  1. Configure the kernel to emit PNG or JPEG images (e.g. matplotlib `%%config InlineBackend.figure_formats = ['png']`)
  2. Avoid output formats like SVG/BMP from the notebook
  3. Convert or re-render the output in a supported format
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/repl/src/outputs/image.rs:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/c7c0988da0c730ca. Report an issue: GitHub.