{"record":{"id":"4363c4a6187c02b0","repo":"openai/codex","slug":"generated-image-exceeds-the-executor-file-size-lim","errorCode":null,"errorMessage":"generated image exceeds the executor file size limit","messagePattern":"generated image exceeds the executor file size limit","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"warning","filePath":"codex-rs/ext/image-generation/src/tool.rs","lineNumber":307,"sourceCode":"                    .write_file(\n                        &PathUri::from_abs_path(&path),\n                        bytes,\n                        Default::default(),\n                        /*sandbox*/ None,\n                    )\n                    .await?;\n                Ok(path)\n            }\n            .await;\n            (output_dir, save_result)\n        }\n        None => {\n            let environment = environment?;\n            let output_dir = environment.cwd.join(\"generated_images\");\n            let save_result: io::Result<AbsolutePathBuf> = async {\n                let result = result.trim();\n                if result.len() > MAX_EXECUTOR_GENERATED_IMAGE_BASE64_BYTES {\n                    return Err(io::Error::new(\n                        io::ErrorKind::InvalidData,\n                        \"generated image exceeds the executor file size limit\",\n                    ));\n                }\n                let bytes = BASE64_STANDARD\n                    .decode(result.as_bytes())\n                    .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;\n                if bytes.len() > MAX_EXECUTOR_GENERATED_IMAGE_BYTES {\n                    return Err(io::Error::new(\n                        io::ErrorKind::InvalidData,\n                        \"generated image exceeds the executor file size limit\",\n                    ));\n                }\n\n                let artifact_path =\n                    image_generation_artifact_path(&environment.cwd, session_id, call_id);\n                let path = output_dir.join(artifact_path.as_path().file_name().unwrap_or_default());\n                let sandbox = Some(&environment.file_system_sandbox_context);","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/ext/image-generation/src/tool.rs#L289-L325","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Host side: request sizes that fit the executor cap, or supply a save_root\nrequest.size = Some(\"1024x1024\");\nrequest.quality = Some(ImageQuality::Medium);","typeGuard":"fn fits_executor_base64_limit(result: &str) -> bool {\n    result.trim().len() <= MAX_EXECUTOR_GENERATED_IMAGE_BASE64_BYTES\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["rust","image-generation","size-limit","executor","codex"],"backgroundTag":"payload-too-large","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}