{"record":{"id":"514cd7509bd56c13","repo":"astral-sh/ruff","slug":"unknown-option-key","errorCode":null,"errorMessage":"Unknown option: {key}","messagePattern":"Unknown option: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ruff/src/commands/config.rs","lineNumber":25,"sourceCode":"\n#[expect(clippy::print_stdout)]\npub(crate) fn config(key: Option<&str>, format: HelpFormat) -> Result<()> {\n    match key {\n        None => {\n            let metadata = Options::metadata();\n            match format {\n                HelpFormat::Text => {\n                    println!(\"{metadata}\");\n                }\n\n                HelpFormat::Json => {\n                    println!(\"{}\", serde_json::to_string_pretty(&metadata)?);\n                }\n            }\n        }\n        Some(key) => match Options::metadata().find(key) {\n            None => {\n                return Err(anyhow!(\"Unknown option: {key}\"));\n            }\n            Some(entry) => match format {\n                HelpFormat::Text => {\n                    print!(\"{entry}\");\n                }\n\n                HelpFormat::Json => {\n                    println!(\"{}\", serde_json::to_string_pretty(&entry)?);\n                }\n            },\n        },\n    }\n    Ok(())\n}\n","sourceCodeStart":7,"sourceCodeEnd":40,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ruff/src/commands/config.rs#L7-L40","documentation":"`ruff config <key>` prints the metadata of one configuration option; this error fires when the requested key does not exist in the option registry (Options::metadata()). The key must name a real Ruff configuration option, not a lint rule or a key borrowed from another tool.","triggerScenarios":"Running e.g. `ruff config line-lenght` (typo), `ruff config rules.E501` (a rule, not an option), or `ruff config mypy.strict` (another tool's setting).","commonSituations":"Typos in option names; wrong section path such as `formatting.line-length` instead of `line-length`; assuming flake8/mypy key names work; scripting `ruff config` with user-supplied keys.","solutions":["Run `ruff config` with no key to list all options, and copy the exact key","Fix the typo or section path, e.g. `ruff config line-length`, `ruff config lint.select`","Use `ruff config --format json` and search the JSON when scripting"],"exampleFix":"# before\nruff config line-lenght\n\n# after\nruff config line-length","handlingStrategy":"validation","validationCode":"# look the key up in the full listing before querying it\nruff config | grep -qw \"$1\" || { echo \"unknown ruff option: $1\" >&2; exit 1; }\nruff config \"$1\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy option keys from `ruff config` output or the settings reference, not from memory","When scripting with user-supplied keys, validate against the listing first","Remember keys are Ruff options (e.g. line-length, lint.select), not rule names"],"tags":["cli","configuration","usage"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}