{"record":{"id":"f4f708af3384aa09","repo":"pbakaus/impeccable","slug":"generate-image-prompt-or-prompt-file-and","errorCode":null,"errorMessage":"generate-image: --prompt (or --prompt-file) and --out are required.\n","messagePattern":"generate-image: --prompt \\(or --prompt-file\\) and --out are required\\.\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context/src/generate_image.rs","lineNumber":257,"sourceCode":"        match std::fs::read(abs(pf)) {\n            Ok(b) => Ok(String::from_utf8_lossy(&b).into_owned()),\n            Err(e) => {\n                io.err(&format!(\"Error: {}\\n\", node_read_error(pf, &e)));\n                Err(1)\n            }\n        }\n    };\n    if env.get(\"IMPECCABLE_IMAGE_GEN_FAKE\").map(|v| !v.is_empty()).unwrap_or(false) {\n        let prompt = match arg(args, \"prompt-file\") {\n            Some(pf) => match read_prompt_file(io, &pf) {\n                Ok(p) => Some(p),\n                Err(c) => return c,\n            },\n            None => arg(args, \"prompt\"),\n        };\n        let out = arg(args, \"out\");\n        let (Some(prompt), Some(out)) = (prompt.filter(|p| !p.is_empty()), out) else {\n            io.err(\"generate-image: --prompt (or --prompt-file) and --out are required.\\n\");\n            return 1;\n        };\n        let (w, h) = parse_size(&arg(args, \"size\").unwrap_or_else(|| \"1536x1024\".into()));\n        let bytes = if out.ends_with(\".svg\") { svg_fake(&prompt, w as f64, h as f64).into_bytes() } else { png_fake(&prompt, w, h) };\n        if let Err(e) = std::fs::write(abs(&out), bytes) {\n            io.err(&format!(\"Error: {}\\n\", node_read_error(&out, &e)));\n            return 1;\n        }\n        io.out(&format!(\"IMAGE: {} ({}x{}, fake synthetic comp, $0.00, no API call)\\n\", out, w, h));\n        return 0;\n    }\n    let Some(key) = env.get(\"OPENAI_API_KEY\").filter(|k| !k.is_empty()).cloned() else {\n        io.err(\"generate-image: OPENAI_API_KEY is not set; use the harness-native image tool instead.\\n\");\n        return 1;\n    };\n    let prompt = match arg(args, \"prompt-file\") {\n        Some(pf) => match read_prompt_file(io, &pf) {\n            Ok(p) => Some(p),","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/context/src/generate_image.rs#L239-L275","documentation":"Required-argument guard in generate-image's fake mode (IMPECCABLE_IMAGE_GEN_FAKE set): the let-else on (Some(prompt), Some(out)) fails when the prompt — taken from --prompt-file contents or --prompt — is missing/empty, or --out was not passed.","triggerScenarios":"Running `impeccable generate-image` without --out, without --prompt/--prompt-file, or with an empty --prompt value.","commonSituations":"Forgot --out while testing interactively, empty shell variable for the prompt, or a script building the command dropped empty arguments.","solutions":["Provide both flags: `impeccable generate-image --prompt \"...\" --out out.png`.","Guard empty prompt variables in scripts before invoking.","Ensure --out points to a writable destination path."],"exampleFix":"// before\nimpeccable generate-image --prompt \"a cat\"\n// after\nimpeccable generate-image --prompt \"a cat\" --out out.png","handlingStrategy":"validation","validationCode":"[ -n \"$PROMPT\" ] && [ -n \"$OUT\" ] || { echo \"--prompt and --out are required\" >&2; exit 1; }","typeGuard":"const canGenerate = (args) => Boolean(args.out && args.prompt && args.prompt.trim().length > 0);","tryCatchPattern":null,"preventionTips":["Always pass both --prompt (or --prompt-file) and --out","Guard required shell variables before invocation","Wrap generate-image calls in a script function that checks arguments"],"tags":["cli","missing-argument","usage"],"backgroundTag":"missing-required-argument","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"}