{"record":{"id":"c5408bc06a485677","repo":"astral-sh/ruff","slug":"valuevalidation-c5408b","errorCode":"ValueValidation","errorMessage":"invalid value '{invalid_value}' for '{invalid_arg}'","messagePattern":"invalid value '(.+?)' for '(.+?)'","errorType":"validation","errorClass":"clap::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff/src/commands/completions/config.rs","lineNumber":124,"sourceCode":"        OptionStringParser\n    }\n}\n\nimpl TypedValueParser for OptionStringParser {\n    type Value = OptionString;\n\n    fn parse_ref(\n        &self,\n        cmd: &clap::Command,\n        arg: Option<&clap::Arg>,\n        value: &std::ffi::OsStr,\n    ) -> Result<Self::Value, clap::Error> {\n        let value = value\n            .to_str()\n            .ok_or_else(|| clap::Error::new(clap::error::ErrorKind::InvalidUtf8))?;\n\n        value.parse().map_err(|()| {\n            let mut error = clap::Error::new(clap::error::ErrorKind::ValueValidation).with_cmd(cmd);\n            if let Some(arg) = arg {\n                error.insert(\n                    clap::error::ContextKind::InvalidArg,\n                    clap::error::ContextValue::String(arg.to_string()),\n                );\n            }\n            error.insert(\n                clap::error::ContextKind::InvalidValue,\n                clap::error::ContextValue::String(value.to_string()),\n            );\n            error\n        })\n    }\n\n    fn possible_values(&self) -> Option<Box<dyn Iterator<Item = PossibleValue> + '_>> {\n        let mut visitor = CollectOptionsVisitor::default();\n        Options::metadata().record(&mut visitor);\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/astral-sh/ruff/blob/d1087a4b9e03d253a88703f34e0869ee4b805456/crates/ruff/src/commands/completions/config.rs#L106-L142","documentation":"The OPTION argument of `ruff option` must be a known ruff settings key: `OptionString::from_str` checks `Options::metadata().has(s)`. An unknown name fails the parse and clap reports ValueValidation with the invalid value and argument name inserted as context.","triggerScenarios":"`ruff option line-lenght` — a typo'd, renamed, or version-mismatched option name, including dotted sub-table names like `lint.select`.","commonSituations":"Completion of an option renamed between ruff versions; typos; stale shell completion caches referencing old option names.","solutions":["List valid names via `ruff option --help` (possible values are enumerated) or tab completion.","Fix the typo or use the current option name for your ruff version.","Regenerate shell completions (`ruff generate-completions <shell>`) after upgrading so cached names are current."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# only pass names ruff actually knows\nif ruff option --help | grep -Fxq -- \"$opt\"; then\n  ruff option \"$opt\"\nelse\n  echo \"unknown ruff option: $opt\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `ruff option --help` or tab completion to discover valid option names.","Regenerate shell completions after every ruff upgrade."],"tags":["ruff","cli","completions","option-name","validation"],"backgroundTag":"unknown-config-option","analyzedSha":"d1087a4b9e03d253a88703f34e0869ee4b805456","analyzedAt":"2026-08-20T16:33:49.445Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}