{"record":{"id":"cf5db4471bd4e69e","repo":"pbakaus/impeccable","slug":"embed-prompt-image-file-required","errorCode":null,"errorMessage":"embed-prompt: image file required\n","messagePattern":"embed-prompt: image file required\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context/src/embed_prompt.rs","lineNumber":238,"sourceCode":"        }\n        let mut missing = 0;\n        for r in &rasters {\n            if prompt_of(&abs(r)).is_none() {\n                io.out(&format!(\"MISSING: {}\\n\", r));\n                missing += 1;\n            }\n        }\n        io.out(&format!(\n            \"SCAN: {} raster{}, {} missing\\n\",\n            rasters.len(),\n            if rasters.len() == 1 { \"\" } else { \"s\" },\n            missing\n        ));\n        return if missing > 0 { 3 } else { 0 };\n    }\n\n    let Some(file) = file.filter(|f| exists(&abs(f))) else {\n        io.err(\"embed-prompt: image file required\\n\");\n        return 1;\n    };\n    let file_abs = abs(&file);\n    let buf = std::fs::read(&file_abs).unwrap_or_default();\n    let ty = image_type(&buf);\n    let png = ty == Some(ImageType::Png);\n    let jpeg = ty == Some(ImageType::Jpeg);\n    let sidecar = format!(\"{}.json\", file);\n    let sidecar_abs = format!(\"{}.json\", file_abs);\n\n    if read_mode {\n        let prompt = read_prompt(&file_abs, &buf);\n        match prompt {\n            None => {\n                io.err(\"embed-prompt: no embedded prompt found\\n\");\n                2\n            }\n            Some(p) => {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/context/src/embed_prompt.rs#L220-L256","documentation":"The embed/write mode of `embed-prompt` requires an image file that exists on disk (passed via --image or a positional). If the flag is absent, empty, or points at a nonexistent path, the CLI prints this and exits 1.","triggerScenarios":"Running `impeccable embed-prompt` (write mode) without --image, with an empty --image value, or with a path that does not exist relative to cwd.","commonSituations":"Forgot to pass --image while only providing --prompt, typoed image path, or referencing an image generated in a different directory in CI.","solutions":["Pass an existing image file: `impeccable embed-prompt --image out.png --prompt \"...\"`.","Verify the path exists (ls) and use an absolute path if unsure about cwd.","Ensure the image-producing step (e.g. generate-image --out) ran before the embed step."],"exampleFix":"// before\nimpeccable embed-prompt --prompt \"a cat\" --out out.png\n// after\nimpeccable embed-prompt --image out.png --prompt \"a cat\"","handlingStrategy":"validation","validationCode":"[ -n \"$IMAGE\" ] && [ -f \"$IMAGE\" ] || { echo \"image file required\" >&2; exit 1; }","typeGuard":"const hasImage = (p) => typeof p === 'string' && p.length > 0 && fs.existsSync(p);","tryCatchPattern":null,"preventionTips":["Always pass --image in write mode","Run embed-prompt after the image-producing step in the pipeline","Use absolute image paths"],"tags":["cli","missing-argument","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}