Morganamilo/paru · error
unknown option
Error message
unknown option --{} What it means
The parser encountered a long option (`--name`) that is neither a recognized pacman argument nor a pacman global argument, so `handle_arg` bails with 'unknown option --{}'. This is the catch-all arm for unrecognized long flags.
Solutions
- Correct the flag spelling (check `--help`)
- Remove the unrecognized flag or use the closest supported equivalent
- Check the version changelog if a flag was renamed between releases
Example fix
// before paru --nosignature // after paru --nosigndb // or another valid flag; check --help
Defensive patterns
Strategy: validation
Validate before calling
function is_known_long_flag(flag: string, known: Set<string>): boolean {
return known.has(flag.replace(/^--/, ''));
} Try / catch
match cli::parse(&args) {
Err(e) if e.to_string().starts_with("unknown option") => {
eprintln!("{} — run with --help for valid options", e);
std::process::exit(2);
}
Err(e) => return Err(e),
Ok(cmd) => cmd.run(),
} Prevention
- Use shell/tab completion generated by the tool itself
- Keep a validated allowlist of flags in wrapper scripts
- Pin the tool version in CI and re-validate flags after upgrades
When it happens
Trigger: Invoking the tool with a long flag like `--foo` or `--repo-sync` that is not in the known pacman/pacman-global sets; typos of valid flags (e.g. `--colour` instead of `--color`).
Common situations: Typoed flags; flags removed/renamed in newer versions of the tool; copy-pasted flags from other package managers; scripts built against an older CLI surface.
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
- option expects a value
- unknown option
- option does not allow a value
- option must be a number
- no targets specified (use -h for help)
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/be3c6150dda25aec.
Report an issue: GitHub.
Appendix: source
Thrown at src/command_line.rs:373
Arg::Long("nochroot") => self.chroot = false,
Arg::Long("sign") => {
self.sign = match value {
Ok(k) => Sign::Key(k.to_string()),
Err(_) => Sign::Yes,
}
}
Arg::Long("nokeeprepocache") => self.keep_repo_cache = false,
Arg::Long("keeprepocache") => self.keep_repo_cache = true,
Arg::Long("signdb") => {
self.sign_db = match value {
Ok(k) => Sign::Key(k.to_string()),
Err(_) => Sign::Yes,
}
}
Arg::Long("nosign") => self.sign = Sign::No,
Arg::Long("nosigndb") => self.sign_db = Sign::No,
Arg::Long(a) if !arg.is_pacman_arg() && !arg.is_pacman_global() => {
bail!(tr!("unknown option --{}", a))
}
Arg::Short(a) if !arg.is_pacman_arg() && !arg.is_pacman_global() => {
bail!(tr!("unknown option -{}", a))
}
_ => (),
}
match takes_value(arg) {
TakesValue::No if forced => bail!(tr!("option {} does not allow a value", arg)),
_ => (),
}
Ok(())
}
}
fn split_whitespace(s: &str) -> Vec<String> {
s.split_whitespace().map(|s| s.to_string()).collect()View on GitHub (pinned to 9ac3578807)