openai/codex · warning · io::Error
generated image exceeds the executor file size limit
Error message
generated image exceeds the executor file size limit
What it means
Executor branch of save_image_generation_result (no save_root): the trimmed base64 image string exceeds MAX_EXECUTOR_GENERATED_IMAGE_BASE64_BYTES before decoding, returning io::ErrorKind::InvalidData. The caller catches it, logs 'failed to save generated image', and returns None — the tool call still succeeds; only workspace persistence is skipped.
Source
Thrown at codex-rs/ext/image-generation/src/tool.rs:307
.write_file(
&PathUri::from_abs_path(&path),
bytes,
Default::default(),
/*sandbox*/ None,
)
.await?;
Ok(path)
}
.await;
(output_dir, save_result)
}
None => {
let environment = environment?;
let output_dir = environment.cwd.join("generated_images");
let save_result: io::Result<AbsolutePathBuf> = async {
let result = result.trim();
if result.len() > MAX_EXECUTOR_GENERATED_IMAGE_BASE64_BYTES {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
"generated image exceeds the executor file size limit",
));
}
let bytes = BASE64_STANDARD
.decode(result.as_bytes())
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
if bytes.len() > MAX_EXECUTOR_GENERATED_IMAGE_BYTES {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
"generated image exceeds the executor file size limit",
));
}
let artifact_path =
image_generation_artifact_path(&environment.cwd, session_id, call_id);
let path = output_dir.join(artifact_path.as_path().file_name().unwrap_or_default());
let sandbox = Some(&environment.file_system_sandbox_context);View on GitHub (pinned to 339751715c)
Solutions
- Request smaller dimensions or lower quality so the base64 payload fits the cap.
- Configure a host-side save_root so artifacts go through the LOCAL_FS path with its 32 MiB decoded cap instead.
- Treat the warning as informational if the in-tool base64 result is sufficient for the model.
Defensive patterns
Strategy: validation
Validate before calling
// Host side: request sizes that fit the executor cap, or supply a save_root
request.size = Some("1024x1024");
request.quality = Some(ImageQuality::Medium); Type guard
fn fits_executor_base64_limit(result: &str) -> bool {
result.trim().len() <= MAX_EXECUTOR_GENERATED_IMAGE_BASE64_BYTES
} Prevention
- Cap requested image dimensions and quality for executor contexts.
- Provide a host save_root when large artifacts are expected — it uses the 32 MiB LOCAL_FS path.
- Watch for the 'failed to save generated image' warning in logs; the tool itself still succeeds.
When it happens
Trigger: An image generation/edit tool result delivered through the executor (environment.cwd-based path) whose base64 payload exceeds the executor size cap (about 4/3 of the 32 MiB decoded limit).
Common situations: High-resolution or lossless PNG output from the image model; quality set to high with a large canvas; executor contexts with no host-provided save root.
Related errors
- generated image destination already exists
- generated image directory is not a real directory
- pid-managed app-server shutdown is unsupported on this platf
- pid-managed updater shutdown is unsupported on this platform
- failed to read start time for pid-managed app server {pid}
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/4363c4a6187c02b0.
Report an issue: GitHub.