openai/codex · error · ImageProcessingError
image is too large ( bytes; max bytes)
Error message
image {representation} is too large ({size} bytes; max {max} bytes) What it means
The TooLarge variant of ImageProcessingError: the image payload (representation describes whether it was a data URL, file, etc.) exceeds the configured maximum byte size. This is an enforced cap on injected image data, not a decode failure.
Solutions
- Downscale or re-compress the image below the size cap
- Reference the image by path/URL instead of inlining it
- Raise the configured max only if the use case justifies larger payloads
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/utils/image/src/error.rs:30 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/cb217350c9c6d8ab.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/utils/image/src/error.rs:30
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,
};
}
let mime = mime_guess::from_path(path)
.first()View on GitHub (pinned to 339751715c)