pbakaus/impeccable · error
generate-image: --prompt (or --prompt-file) and --out are re
Error message
generate-image: --prompt (or --prompt-file) and --out are required.
What it means
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.
Source
Thrown at crates/context/src/generate_image.rs:257
match std::fs::read(abs(pf)) {
Ok(b) => Ok(String::from_utf8_lossy(&b).into_owned()),
Err(e) => {
io.err(&format!("Error: {}\n", node_read_error(pf, &e)));
Err(1)
}
}
};
if env.get("IMPECCABLE_IMAGE_GEN_FAKE").map(|v| !v.is_empty()).unwrap_or(false) {
let prompt = match arg(args, "prompt-file") {
Some(pf) => match read_prompt_file(io, &pf) {
Ok(p) => Some(p),
Err(c) => return c,
},
None => arg(args, "prompt"),
};
let out = arg(args, "out");
let (Some(prompt), Some(out)) = (prompt.filter(|p| !p.is_empty()), out) else {
io.err("generate-image: --prompt (or --prompt-file) and --out are required.\n");
return 1;
};
let (w, h) = parse_size(&arg(args, "size").unwrap_or_else(|| "1536x1024".into()));
let bytes = if out.ends_with(".svg") { svg_fake(&prompt, w as f64, h as f64).into_bytes() } else { png_fake(&prompt, w, h) };
if let Err(e) = std::fs::write(abs(&out), bytes) {
io.err(&format!("Error: {}\n", node_read_error(&out, &e)));
return 1;
}
io.out(&format!("IMAGE: {} ({}x{}, fake synthetic comp, $0.00, no API call)\n", out, w, h));
return 0;
}
let Some(key) = env.get("OPENAI_API_KEY").filter(|k| !k.is_empty()).cloned() else {
io.err("generate-image: OPENAI_API_KEY is not set; use the harness-native image tool instead.\n");
return 1;
};
let prompt = match arg(args, "prompt-file") {
Some(pf) => match read_prompt_file(io, &pf) {
Ok(p) => Some(p),View on GitHub (pinned to 2bc2879276)
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.
Example fix
// before impeccable generate-image --prompt "a cat" // after impeccable generate-image --prompt "a cat" --out out.png
Defensive patterns
Strategy: validation
Validate before calling
[ -n "$PROMPT" ] && [ -n "$OUT" ] || { echo "--prompt and --out are required" >&2; exit 1; } Type guard
const canGenerate = (args) => Boolean(args.out && args.prompt && args.prompt.trim().length > 0);
Prevention
- 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
When it happens
Trigger: Running `impeccable generate-image` without --out, without --prompt/--prompt-file, or with an empty --prompt value.
Common situations: Forgot --out while testing interactively, empty shell variable for the prompt, or a script building the command dropped empty arguments.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- usage: comp-diff.mjs --comp <png> --build <png> [--spec spec
- usage: comp-spec.mjs --comp <png> (--grid | --regions <json>
- usage: write <slug-or-target> <body-file>
- embed-prompt: --scan needs at least one directory
- surface brief path requires a concrete target
AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08).
Data as JSON: /api/errors/f4f708af3384aa09.
Report an issue: GitHub.