pbakaus/impeccable · error
{}
Error message
{}
What it means
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.
Source
Thrown at crates/context/src/doctor.rs:250
}
lines.join("\n")
}
pub fn run(args: &[String], io: &mut Io) -> i32 {
let cwd = io.cwd.to_string_lossy().into_owned();
let env = io.env.clone();
let provider = crate::provider::detect(&env, &cwd);
// The printed fix command spells the launcher when the launcher exported
// IMPECCABLE_SELF, and the plain `impeccable` verb otherwise.
let self_cmd = env
.get("IMPECCABLE_SELF")
.map(|v| v.trim().to_string())
.filter(|v| !v.is_empty())
.unwrap_or_else(|| "impeccable".to_string());
let (flags, target) = match parse_args(args) {
Ok(v) => v,
Err(msg) => {
io.err(&format!("{}\n", msg));
return 1;
}
};
if flags.help {
io.out(&format!("{}\n", usage()));
return 0;
}
let report = collect(&cwd, &target, &env, &provider.id);
let fixes = if flags.fix { Some(apply_fixes(&report)) } else { None };
if flags.json {
let mut m = Map::new();
m.insert("projectRoot".into(), Value::String(report.project_root.clone()));
m.insert("repoRoot".into(), Value::String(report.ctx.repo_root.clone()));
m.insert("isMonorepo".into(), Value::Bool(report.ctx.is_monorepo));
m.insert("productPath".into(), opt_string(&report.ctx.product_path));
m.insert("designPath".into(), opt_string(&report.ctx.design_path));
m.insert("platform".into(), opt_string(&report.ctx.platform));
m.insert("ruleRegistryAvailable".into(), Value::Bool(report.rule_registry_available));View on GitHub (pinned to 2bc2879276)
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.
Example fix
// before impeccable doctor --traget ./app // after impeccable doctor --target ./app
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN = new Set(['--target', '--help']);
for (const a of args) {
if (a.startsWith('--') && !KNOWN.has(a)) throw new Error(`unsupported doctor flag: ${a}`);
} Try / catch
try {
runCapture('impeccable', ['doctor', ...args]);
} catch (e) {
if (e.exitCode === 1 && /usage|--/.test(e.stderr)) {
// fall back to flagless `impeccable doctor` for valid usage
}
} Prevention
- 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.
When it happens
Trigger: Running `impeccable doctor` with an unrecognized flag, a flag missing its value (`--target` with nothing after), or a positional/target that parse_args rejects.
Common situations: 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.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- {}
- usage: latest <slug-or-target> [--json]
- usage: close <resolved-target> <snapshot-file>
- usage: impeccable critique-storage <slug|write|latest|trend|
- usage: impeccable surface-brief <path|list|read|write> [targ
AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08).
Data as JSON: /api/errors/78131cc8c063e4d9.
Report an issue: GitHub.