{"record":{"id":"5fc4817019e7cd05","repo":"astral-sh/ruff","slug":"valuevalidation","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/args.rs","lineNumber":1032,"sourceCode":"\n        let _guard = ValueSourceGuard::new(ValueSource::Cli, false);\n\n        let config_parse_error = match toml::Table::from_str(value) {\n            Ok(table) => match Options::from_toml_table(table) {\n                Ok(option) => {\n                    if option.extend.is_none() {\n                        return Ok(SingleConfigArgument::SettingsOverride(Arc::new(option)));\n                    }\n                    InvalidConfigFlagReason::ExtendPassedViaConfigFlag\n                }\n                Err(underlying_error) => {\n                    InvalidConfigFlagReason::ValidTomlButInvalidRuffSchema(underlying_error)\n                }\n            },\n            Err(underlying_error) => InvalidConfigFlagReason::InvalidToml(underlying_error),\n        };\n\n        let mut new_error = clap::Error::new(clap::error::ErrorKind::ValueValidation).with_cmd(cmd);\n        if let Some(arg) = arg {\n            new_error.insert(\n                clap::error::ContextKind::InvalidArg,\n                clap::error::ContextValue::String(arg.to_string()),\n            );\n        }\n        new_error.insert(\n            clap::error::ContextKind::InvalidValue,\n            clap::error::ContextValue::String(value.to_string()),\n        );\n\n        let underlying_error = match &config_parse_error {\n            InvalidConfigFlagReason::ExtendPassedViaConfigFlag => {\n                let tip = config_parse_error.description().into();\n                new_error.insert(\n                    clap::error::ContextKind::Suggested,\n                    clap::error::ContextValue::StyledStrs(vec![tip]),\n                );","sourceCodeStart":1014,"sourceCodeEnd":1050,"githubUrl":"https://github.com/astral-sh/ruff/blob/d1087a4b9e03d253a88703f34e0869ee4b805456/crates/ruff/src/args.rs#L1014-L1050","documentation":"When `--config` receives inline TOML, ruff parses it and validates it against its settings schema. Any failure — malformed TOML, unknown or incorrectly typed options, or smuggling `extend` through the flag — is reported as a clap ValueValidation error whose contexts carry the invalid value and argument name, with the underlying InvalidConfigFlagReason rendered alongside.","triggerScenarios":"`ruff check --config 'select=['` (broken TOML), `--config 'line-length = \"many\"'` (wrong type for the schema), `--config 'extend = \"base.toml\"'` (extend not allowed via the flag), or an option name that does not exist in the installed ruff version.","commonSituations":"Shell quoting mistakes; options copied from a newer or older ruff version's docs; YAML/JSON habits (unquoted or differently-cased keys) carried into TOML.","solutions":["Read the reason printed after the clap message — it distinguishes invalid TOML from a schema rejection and names the failing option.","Validate the snippet with a TOML parser first, e.g. `python -c \"import tomllib; tomllib.loads(open('/dev/stdin').read())\"`.","Check the option name and type against `ruff help` and the settings reference for the installed version.","Move the settings into pyproject.toml and pass its path via --config to iterate with better error reporting."],"exampleFix":"# before: value has the wrong type for the schema\nruff check --config 'line-length = \"100\"' .\n\n# after: integer, as the schema requires\nruff check --config 'line-length = 100' .","handlingStrategy":"validation","validationCode":"# validate inline TOML before handing it to ruff\nprintf '%s' 'line-length = 100' | python -c 'import sys, tomllib; tomllib.loads(sys.stdin.read())' \\\n  && ruff check --config 'line-length = 100' .","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check option names and types against the settings docs for the exact ruff version in use.","Quote inline TOML with single quotes in shells to avoid interpolation.","Prefer pyproject.toml for anything non-trivial; the file path gets richer diagnostics."],"tags":["ruff","cli","config","toml","schema-validation"],"backgroundTag":"config-validation-failed","analyzedSha":"d1087a4b9e03d253a88703f34e0869ee4b805456","analyzedAt":"2026-08-20T16:33:49.445Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}