{"record":{"id":"05bece762ec88bf0","repo":"Morganamilo/paru","slug":"option-must-be-a-number","errorCode":null,"errorMessage":"option {} must be a number","messagePattern":"option (.+?) must be a number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/command_line.rs","lineNumber":212,"sourceCode":"            Arg::Long(\"sudoflags\") => self.sudo_flags.extend(split_whitespace(value?)),\n            Arg::Long(\"batflags\") => self.bat_flags.extend(split_whitespace(value?)),\n            Arg::Long(\"fmflags\") => self.fm_flags.extend(split_whitespace(value?)),\n            Arg::Long(\"chrootflags\") => self.chroot_flags.extend(split_whitespace(value?)),\n            Arg::Long(\"chrootpkgs\") => self\n                .chroot_pkgs\n                .extend(value?.split(',').map(|s| s.to_string())),\n            Arg::Long(\"rootchrootpkgs\") => self\n                .root_chroot_pkgs\n                .extend(value?.split(',').map(|s| s.to_string())),\n\n            Arg::Long(\"develsuffixes\") => self.devel_suffixes = split_whitespace(value?),\n            Arg::Long(\"installdebug\") => self.install_debug = true,\n            Arg::Long(\"noinstalldebug\") => self.install_debug = false,\n\n            Arg::Long(\"completioninterval\") => {\n                self.completion_interval = value?\n                    .parse()\n                    .map_err(|_| anyhow!(\"option {} must be a number\", arg))?\n            }\n            Arg::Long(\"sortby\") => self.sort_by = ConfigEnum::from_str(argkey, value?)?,\n            Arg::Long(\"searchby\") => self.search_by = ConfigEnum::from_str(argkey, value?)?,\n            Arg::Long(\"limit\") => self.limit = value?.parse()?,\n            Arg::Long(\"news\") | Arg::Short('w') => self.news += 1,\n            Arg::Long(\"stats\") => self.stats = true,\n            Arg::Short('s') => {\n                self.stats = true;\n                self.ssh = true;\n            }\n            Arg::Long(\"order\") => self.order = true,\n            Arg::Short('o') => {\n                self.order = true;\n                self.optional = true;\n            }\n            Arg::Long(\"removemake\") => {\n                self.remove_make = YesNoAsk::Yes.default_or(argkey, value.ok())?\n            }","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/command_line.rs#L194-L230","documentation":"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.","triggerScenarios":"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.","commonSituations":"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`.","solutions":["Pass a plain integer: `--completioninterval 5`","Fix scripts so the interpolated variable is numeric","Check the accepted range/type (integer) in the docs"],"exampleFix":"// before\nparu --completioninterval 30s\n// after\nparu --completioninterval 30","handlingStrategy":"validation","validationCode":"function is_plain_int(s: string): boolean {\n  return /^\\d+$/.test(s.trim());\n}\n// before exec: if (!is_plain_int(interval)) throw new Error('--completioninterval must be a number');","typeGuard":null,"tryCatchPattern":"match cli::parse(&args) {\n    Err(e) if e.to_string().contains(\"must be a number\") => {\n        eprintln!(\"{} — pass a plain integer, e.g. --completioninterval 5\", e);\n        std::process::exit(2);\n    }\n    Err(e) => return Err(e),\n    Ok(cmd) => cmd.run(),\n}","preventionTips":["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"],"tags":["cli","parse-error","numeric-value"],"backgroundTag":"invalid-argument-value","analyzedSha":"9ac3578807a87858651e81a02586ceb947686e7c","analyzedAt":"2026-09-12T04:57:59.861Z","contentChangedAt":"2026-09-12T04:57:59.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}