{"record":{"id":"514cd7509bd56c13","repo":"astral-sh/ruff","slug":"unknown-option-key","errorCode":null,"errorMessage":"Unknown option: {key}","messagePattern":"Unknown option: (.+?)","errorType":"exception","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/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff/src/commands/config.rs#L7-L40","documentation":"`ruff config <key>` looks up `key` among the options declared in `Options` metadata and errors when the key is not a known Ruff configuration option. It tells the user the requested option name does not exist in Ruff's settings schema.","triggerScenarios":"Running `ruff config <key>` (or `ruff config --help <key>`-style lookup) where `<key>` is not found by `Options::metadata().find(key)`.","commonSituations":"Typos in the option name, asking about a setting from another tool (e.g. Flake8's `max-line-length` or an old pre-0.2 nested name), or querying settings that were renamed or removed in newer Ruff versions.","solutions":["Run `ruff config` with no key to list all valid option names, then use the exact spelling.","Check `ruff check --help` and the settings documentation for renamed keys (e.g. top-level `line-length` vs deprecated nested names).","If the option belongs to a plugin or another tool, remove it from the Ruff config and configure the correct tool instead."],"exampleFix":"// before\n$ ruff config max-line-lenght\n// after\n$ ruff config line-length","handlingStrategy":"validation","validationCode":"KEY=\"line-length\"\nruff config 2>/dev/null | grep -qx \"$KEY\" && ruff config \"$KEY\" || echo \"unknown option: $KEY\"","typeGuard":null,"tryCatchPattern":"match ruff_config(key) {\n    Err(e) if e.to_string().starts_with(\"Unknown option: \") => {\n        eprintln!(\"Invalid key '{}'; run `ruff config` to list valid options\", key);\n    }\n    other => other?,\n}","preventionTips":["List valid keys with `ruff config` before scripting lookups.","Copy option names from the settings documentation rather than memory.","When upgrading Ruff, diff renamed/removed options from the changelog."],"tags":["cli","configuration","ruff"],"backgroundTag":"unknown-config-option","analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}