astrid-runtime/astrid · error
--output requires a path
Error message
--output requires a path
What it means
CLI argument parse error in `parse_options`: `--output` was given but the next argument is missing. The flag requires a following filesystem path where the compact JSON report is written instead of stdout.
Source
Thrown at crates/astrid-storage-chunker-evidence/src/main.rs:176
version_chain_specs.push(parse_path_specification("--version-chain", args.next())?);
},
"--git-history" => {
git_history_specs.push(parse_git_specification(args.next())?);
},
"--no-synthetic" => include_synthetic = false,
"--sketch-only" => sketch_only = true,
"--target-kib" => {
let target = args
.next()
.ok_or_else(|| anyhow::anyhow!("--target-kib requires an integer"))?
.parse::<u32>()
.context("parse --target-kib")?;
targets_kib.push(target);
},
"--output" => {
let path = args
.next()
.ok_or_else(|| anyhow::anyhow!("--output requires a path"))?;
output = Some(PathBuf::from(path));
},
"-h" | "--help" => {
print_help();
std::process::exit(0);
},
unknown => bail!("unknown argument {unknown:?}; use --help"),
}
}
if targets_kib.is_empty() {
targets_kib.push(64);
}
targets_kib.sort_unstable();
targets_kib.dedup();
Ok(Options {
corpus_specs,
version_chain_specs,
git_history_specs,View on GitHub (pinned to affd8760f4)
Solutions
- Supply the path: `--output report.json`.
- In scripts, verify the output variable is non-empty before invoking the binary.
- Check `--help` for the `--output PATH` syntax.
Example fix
// before mybin --corpus c=dir --output // after mybin --corpus c=dir --output out/report.json
Defensive patterns
Strategy: validation
Validate before calling
fn output_path_provided(args: &[String]) -> bool {
args.iter().position(|a| a == "--output")
.map(|i| args.get(i + 1).map_or(false, |v| !v.starts_with("--")))
.unwrap_or(false)
} Try / catch
let path = std::env::args().skip(1)
.skip_while(|a| a != "--output").nth(1);
assert!(path.is_some(), "--output requires a path"); Prevention
- Verify script variables holding output paths are non-empty before invocation.
- Never treat --output as a boolean flag.
- Check --help for the required `--output PATH` form.
When it happens
Trigger: Running the binary as `... --output` with no path after it — the flag ends the argument list or is followed by another flag, so `args.next()` returns `None`.
Common situations: Truncated command from a script; empty variable interpolated as the output path; mistaking `--output` for a boolean flag and passing only it.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- unknown argument {unknown:?}; use --help
- --var must be KEY=VALUE (got {item:?})
- --target-kib requires an integer
- --git-history requires NAME=REPO::RELATIVE_PATH
- {flag} requires NAME=PATH
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/1527677e717180f0.
Report an issue: GitHub.