{"record":{"id":"4ee058fdd87ce193","repo":"pbakaus/impeccable","slug":"error-unknown-scope-value-s-valid-scopes","errorCode":null,"errorMessage":"Error: unknown --scope value(s): {}. Valid scopes: {scopes_valid}\n","messagePattern":"Error: unknown --scope value\\(s\\): (.+?)\\. Valid scopes: (.+?)\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/detect/src/cli.rs","lineNumber":495,"sourceCode":"            io.err(\"Error: --viewport requires a WxH value, e.g. --viewport 390x844\\n\");\n            return Err(Exit(1));\n        };\n        viewport = Some((m[1].parse().unwrap_or(0), m[2].parse().unwrap_or(0)));\n        let n = if inline { 1 } else { 2 };\n        for _ in 0..n {\n            if i < args.len() {\n                args.remove(i);\n            }\n        }\n    }\n    let valid = rule_scopes();\n    let unknown: Vec<&String> = scopes\n        .iter()\n        .filter(|s| !valid.contains(&s.as_str()))\n        .collect();\n    if !unknown.is_empty() {\n        let list: Vec<&str> = unknown.iter().map(|s| s.as_str()).collect();\n        io.err(&format!(\n            \"Error: unknown --scope value(s): {}. Valid scopes: {scopes_valid}\\n\",\n            list.join(\", \")\n        ));\n        return Err(Exit(1));\n    }\n    let design_system_enabled = config_enabled\n        && !has(&args, \"--no-design-system\")\n        && detection_config.design_system_not_disabled();\n    let inline_ignores_enabled = config_enabled && !has(&args, \"--no-inline-ignores\");\n    let base = ScanOptions {\n        inline_ignores: inline_ignores_enabled,\n        design_system: None,\n        viewport,\n        profile: None,\n        // The `impeccable` binary installs no rule pack; a library caller that\n        // does sets this before handing the options to an engine.\n        rule_pack: None,\n    };","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/detect/src/cli.rs#L477-L513","documentation":"After collecting `--scope` values, the detect CLI filters them against the set of valid scope names and exits with code 1 if any value is unrecognized. The message echoes the unknown value(s) and the list of valid scopes, so the developer can see exactly which token was wrong.","triggerScenarios":"Running e.g. `impeccable detect src/ --scope layouts` or `--scope typography,colour` where one or more comma-separated values are not in the valid scopes list.","commonSituations":"Typos or wrong plurality of scope names; guessing scope names from other tools' vocabularies; config files or scripts with hard-coded scope lists that drifted from the current CLI's supported set.","solutions":["Read the `Valid scopes:` list from the message and replace the unknown values with exact matches (case-sensitive), e.g. `--scope layout,spacing`.","Run `impeccable detect --help` to see the current scope names.","Update any scripts/configs that hard-code scope lists after upgrading the CLI."],"exampleFix":"// before\nimpeccable detect src/ --scope layouts,touch\n// after\nimpeccable detect src/ --scope layout,touch-targets","handlingStrategy":"validation","validationCode":"const VALID_SCOPES = new Set([\"layout\", \"spacing\"]); // keep in sync with CLI --help\nconst scopes = (scopeArg ?? \"\").split(\",\").map(s => s.trim()).filter(Boolean);\nconst unknown = scopes.filter(s => !VALID_SCOPES.has(s));\nif (unknown.length) throw new Error(`unknown scopes: ${unknown.join(\", \")}`);","typeGuard":null,"tryCatchPattern":"const r = spawnSync(\"impeccable\", [\"detect\", ...args]);\nif (r.status !== 0 && /unknown --scope value/.test(r.stderr.toString())) {\n  console.error(\"Scope names out of date — refresh from `impeccable detect --help`.\");\n}","preventionTips":["Keep a single source of truth for scope names shared with scripts","Re-validate scope lists after every CLI upgrade","Parse the `Valid scopes:` hint from the error message to self-correct"],"tags":["cli","flags","validation","enum","scope"],"backgroundTag":"invalid-enum-value","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}