{"record":{"id":"78131cc8c063e4d9","repo":"pbakaus/impeccable","slug":"error-78131c","errorCode":null,"errorMessage":"{}\n","messagePattern":"\\{\\}\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context/src/doctor.rs","lineNumber":250,"sourceCode":"    }\n    lines.join(\"\\n\")\n}\n\npub fn run(args: &[String], io: &mut Io) -> i32 {\n    let cwd = io.cwd.to_string_lossy().into_owned();\n    let env = io.env.clone();\n    let provider = crate::provider::detect(&env, &cwd);\n    // The printed fix command spells the launcher when the launcher exported\n    // IMPECCABLE_SELF, and the plain `impeccable` verb otherwise.\n    let self_cmd = env\n        .get(\"IMPECCABLE_SELF\")\n        .map(|v| v.trim().to_string())\n        .filter(|v| !v.is_empty())\n        .unwrap_or_else(|| \"impeccable\".to_string());\n    let (flags, target) = match parse_args(args) {\n        Ok(v) => v,\n        Err(msg) => {\n            io.err(&format!(\"{}\\n\", msg));\n            return 1;\n        }\n    };\n    if flags.help {\n        io.out(&format!(\"{}\\n\", usage()));\n        return 0;\n    }\n    let report = collect(&cwd, &target, &env, &provider.id);\n    let fixes = if flags.fix { Some(apply_fixes(&report)) } else { None };\n    if flags.json {\n        let mut m = Map::new();\n        m.insert(\"projectRoot\".into(), Value::String(report.project_root.clone()));\n        m.insert(\"repoRoot\".into(), Value::String(report.ctx.repo_root.clone()));\n        m.insert(\"isMonorepo\".into(), Value::Bool(report.ctx.is_monorepo));\n        m.insert(\"productPath\".into(), opt_string(&report.ctx.product_path));\n        m.insert(\"designPath\".into(), opt_string(&report.ctx.design_path));\n        m.insert(\"platform\".into(), opt_string(&report.ctx.platform));\n        m.insert(\"ruleRegistryAvailable\".into(), Value::Bool(report.rule_registry_available));","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/context/src/doctor.rs#L232-L268","documentation":"The doctor subcommand parses its args via parse_args; an unparseable argument (unknown flag or malformed option value) makes parse_args return Err(msg), and run prints that message (via the uncaught format) to stderr and exits 1 before doing any checks.","triggerScenarios":"Running `impeccable doctor` with an unrecognized flag, a flag missing its value (`--target` with nothing after), or a positional/target that parse_args rejects.","commonSituations":"Typos like `--traget`, copying flags from another subcommand that doctor doesn't support, scripts interpolating empty flag values (`--target ''` patterns), or old flag names removed in a newer engine version.","solutions":["Run `impeccable doctor` with no flags first to see valid usage output.","Correct or remove the unsupported/malformed flag named in the printed message.","Supply the value a flag requires (e.g. `--target <path>`) instead of leaving it empty.","If migrating from an older version, check for renamed flags and use the current names."],"exampleFix":"// before\nimpeccable doctor --traget ./app\n// after\nimpeccable doctor --target ./app","handlingStrategy":"validation","validationCode":"const KNOWN = new Set(['--target', '--help']);\nfor (const a of args) {\n  if (a.startsWith('--') && !KNOWN.has(a)) throw new Error(`unsupported doctor flag: ${a}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  runCapture('impeccable', ['doctor', ...args]);\n} catch (e) {\n  if (e.exitCode === 1 && /usage|--/.test(e.stderr)) {\n    // fall back to flagless `impeccable doctor` for valid usage\n  }\n}","preventionTips":["Run flagless `impeccable doctor` first to learn the accepted flags.","Check flags against current docs after engine upgrades.","Never pass a flag without its required value.","Keep flag names lowercase-hyphenated as documented."],"tags":["cli","argument-parsing","invalid-flag","usage"],"backgroundTag":"invalid-flag-value","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}