openai/codex · error · ImageProcessingError
invalid image data URL
Error message
invalid image data URL: {reason} What it means
The InvalidDataUrl variant of ImageProcessingError: an input was presented as a data: URL but failed structural parsing (bad prefix, missing base64/body, or invalid metadata). The specific reason string identifies which check failed.
Solutions
- Re-generate the data URL with a proper 'data:<mime>;base64,<payload>' shape
- Pass the image as a file path or remote URL instead of a data URL
- Fix the truncation or encoding issue identified by the reason string
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/utils/image/src/error.rs:28 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/772b681f625e60d3.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/utils/image/src/error.rs:28
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)