astrid-runtime/astrid · error

unknown argument {unknown:?}; use --help

Error message

unknown argument {unknown:?}; use --help

What it means

CLI argument fallback arm of parse_options in the chunker-evidence utility binary: a flag was passed that matches none of the recognized options (--target-kib, --output, --help, etc.). A pure argument-validation error in a developer tool; the message directs the user to --help for the accepted set.

Source

Thrown at crates/astrid-storage-chunker-evidence/src/main.rs:183

            "--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,
        include_synthetic,
        sketch_only,
        targets_kib,
        output,
    })
}

View on GitHub (pinned to affd8760f4)

Solutions

  1. Run the binary with `--help` to list accepted flags and fix the typo
  2. Update wrapper/CI scripts to the current flag names
  3. If a flag was recently renamed, consult the changelog and switch to the new spelling

Example fix

// before
bin --targets=64,128
// after
bin --help            # check accepted form
bin --targets 64 128  # per documented usage
Defensive patterns

Strategy: try-catch

Validate before calling

const KNOWN: [&str; 8] = ["--targets", "--corpus", "--git-history", "--no-synthetic", "--output", "--help", "-h", "--version"];
let unknown: Vec<_> = args.iter().filter(|a| a.starts_with("--") && !KNOWN.contains(&a.as_str())).collect();
assert!(unknown.is_empty(), "unknown flags: {unknown:?}");

Try / catch

match run_cli(args) {
    Err(e) if e.to_string().starts_with("unknown argument") => {
        eprintln!("{e}; printing help");
        print_usage_and_exit(2);
    }
    other => other,
}

Prevention

When it happens

Trigger: Invoking the binary with a misspelled flag (e.g. `--corpra`), a flag from a different tool, an option missing its `--` prefix, or a positional value the parser doesn't accept.

Common situations: Typos, translating flags from similar benchmark tools, outdated wrapper scripts referencing removed options, or forgetting that `=`-style values must match documented forms.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/813bcccbb3e54bd4. Report an issue: GitHub.