Morganamilo/paru · error
option must be a number
Error message
option {} must be a number What it means
This is a numeric parse failure thrown from handle_arg (src/command_line.rs), the per-option dispatcher called by parse_arg. It fires when an option is given a value that must be interpreted as a number (a numeric CLI option such as a parallelism/limit flag) and the supplied string cannot be converted to that numeric type. It is a generic validation guard in the argument-handling match: the invalid input is the raw string attached to the offending option on the command line (for example a misspelled number, trailing characters, or an empty value that the option syntax still routed through the value path). The parse aborts with this message rather than silently clamping or defaulting the value.
Solutions
- Pass a plain integer: `--completioninterval 5`
- Fix scripts so the interpolated variable is numeric
- Check the accepted range/type (integer) in the docs
Example fix
// before paru --completioninterval 30s // after paru --completioninterval 30
Defensive patterns
Strategy: validation
Validate before calling
function is_plain_int(s: string): boolean {
return /^\d+$/.test(s.trim());
}
// before exec: if (!is_plain_int(interval)) throw new Error('--completioninterval must be a number'); Try / catch
match cli::parse(&args) {
Err(e) if e.to_string().contains("must be a number") => {
eprintln!("{} — pass a plain integer, e.g. --completioninterval 5", e);
std::process::exit(2);
}
Err(e) => return Err(e),
Ok(cmd) => cmd.run(),
} Prevention
- Coerce/validate numeric config values in scripts before interpolation
- Don't attach units or decimal separators to integer options
- Document expected value formats next to each flag
When it happens
Trigger: Running with a non-numeric value, e.g. `--completioninterval abc`, `--completioninterval 5.5` (if the target integer type rejects it), or an empty string from an empty variable.
Common situations: Config scripts interpolating non-numeric values; users giving a time unit like `30s` or `5m` when only a bare number is accepted; locale-formatted numbers like `1,5`.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- option expects a value
- unknown option
- unknown option
- option does not allow a value
- invalid value ' ' for key ' ', expected
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/05bece762ec88bf0.
Report an issue: GitHub.
Appendix: source
Thrown at src/command_line.rs:212
Arg::Long("sudoflags") => self.sudo_flags.extend(split_whitespace(value?)),
Arg::Long("batflags") => self.bat_flags.extend(split_whitespace(value?)),
Arg::Long("fmflags") => self.fm_flags.extend(split_whitespace(value?)),
Arg::Long("chrootflags") => self.chroot_flags.extend(split_whitespace(value?)),
Arg::Long("chrootpkgs") => self
.chroot_pkgs
.extend(value?.split(',').map(|s| s.to_string())),
Arg::Long("rootchrootpkgs") => self
.root_chroot_pkgs
.extend(value?.split(',').map(|s| s.to_string())),
Arg::Long("develsuffixes") => self.devel_suffixes = split_whitespace(value?),
Arg::Long("installdebug") => self.install_debug = true,
Arg::Long("noinstalldebug") => self.install_debug = false,
Arg::Long("completioninterval") => {
self.completion_interval = value?
.parse()
.map_err(|_| anyhow!("option {} must be a number", arg))?
}
Arg::Long("sortby") => self.sort_by = ConfigEnum::from_str(argkey, value?)?,
Arg::Long("searchby") => self.search_by = ConfigEnum::from_str(argkey, value?)?,
Arg::Long("limit") => self.limit = value?.parse()?,
Arg::Long("news") | Arg::Short('w') => self.news += 1,
Arg::Long("stats") => self.stats = true,
Arg::Short('s') => {
self.stats = true;
self.ssh = true;
}
Arg::Long("order") => self.order = true,
Arg::Short('o') => {
self.order = true;
self.optional = true;
}
Arg::Long("removemake") => {
self.remove_make = YesNoAsk::Yes.default_or(argkey, value.ok())?
}View on GitHub (pinned to 9ac3578807)