openai/codex · error · ImageProcessingError

unsupported image

Error message

unsupported image `{mime}`

What it means

The UnsupportedImageFormat variant of ImageProcessingError: the input's MIME type is not one the image pipeline accepts, so processing is refused before decode. The offending mime string is carried in the variant for diagnosis.

Solutions

  1. Convert the asset to a supported format (e.g. image/png or image/jpeg)
  2. Fix the MIME label if the bytes are actually a supported format
  3. Skip or reject the attachment at the UI boundary before submission
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/utils/image/src/error.rs:26 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/e7a416130e8b12cf. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/utils/image/src/error.rs:26

    #[error("failed to read image at {path}: {source}")]
    Read {
        path: PathBuf,
        #[source]
        source: std::io::Error,
    },
    #[error("failed to decode image at {path}: {source}")]
    Decode {
        path: PathBuf,
        #[source]
        source: image::ImageError,
    },
    #[error("failed to encode image as {format:?}: {source}")]
    Encode {
        format: ImageFormat,
        #[source]
        source: image::ImageError,
    },
    #[error("unsupported image `{mime}`")]
    UnsupportedImageFormat { mime: String },
    #[error("invalid image data URL: {reason}")]
    InvalidDataUrl { reason: String },
    #[error("image {representation} is too large ({size} bytes; max {max} bytes)")]
    ImageTooLarge {
        representation: &'static str,
        size: usize,
        max: usize,
    },
}

impl ImageProcessingError {
    pub fn decode_error(path: &std::path::Path, source: image::ImageError) -> Self {
        if matches!(source, ImageError::Decoding(_)) {
            return ImageProcessingError::Decode {
                path: path.to_path_buf(),
                source,
            };

View on GitHub (pinned to 339751715c)