pbakaus/impeccable · error

Pass a rule id, e.g.

Error message

Pass a rule id, e.g. ${IMPECCABLE_COMMAND} hooks ignore-rule side-tab

What it means

Thrown by addIgnoreRule when the positional rule id is empty after parsing. parseIgnoreRuleArgs collects non-flag tokens as positionals and normalizes the first one; if none is present (or it normalizes to empty), the command cannot know which detector rule to suppress and refuses rather than writing a blank entry into detector.ignoreRules.

Solutions

  1. Pass a detector rule id as the first positional: `hooks ignore-rule side-tab`.
  2. Take the exact id from the finding output of the detector run — ids are kebab-case like side-tab, low-contrast, flat-type-hierarchy.
  3. If the id vanished into --reason, reorder: rule id first, flags after.

Example fix

# before
impeccable hooks ignore-rule --reason "agreed to skip"

# after
impeccable hooks ignore-rule side-tab --reason "agreed to skip"
Defensive patterns

Strategy: validation

Validate before calling

function hasRuleId(args) {
  const flagsWithValues = new Set(['--reason']);
  for (let i = 0; i < args.length; i++) {
    const a = args[i];
    if (a.startsWith('--')) { if (flagsWithValues.has(a)) i++; continue; }
    return true; // first positional = rule id
  }
  return false;
}
if (!hasRuleId(args)) throw new Error('rule id missing before calling addIgnoreRule');

Try / catch

try { addIgnoreRule(cwd, args); } catch (e) { if (/^Pass a rule id/.test(e.message)) printUsage(); else throw e; }

Prevention

When it happens

Trigger: `hooks ignore-rule` with no arguments at all; `hooks ignore-rule --all-values` (flag present but no rule id); `hooks ignore-rule --reason "too noisy"` (only the reason flag given); passing the rule after a flag token that swallows it, e.g. `--reason side-tab` where 'side-tab' is consumed as the reason text.

Common situations: User runs the bare subcommand expecting an interactive prompt; agent omits the rule id; the rule id got absorbed by a preceding --reason value.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pbakaus/impeccable@f88b2837a7 (2026-08-18). Data as JSON: /api/errors/17545a77451385e2. Report an issue: GitHub.

Appendix: source

Thrown at skill/scripts/hook-admin.mjs:579

    } else if (arg.startsWith('--reason=')) {
      // Accepted for command symmetry; ignoreRules stores rule ids only.
    } else if (arg.startsWith('--')) {
      throw new Error(`Unknown ignore-rule flag: ${arg}`);
    } else {
      positionals.push(arg);
    }
  }

  return {
    rule: normalizeRuleId(positionals[0]),
    allValues,
  };
}

function addIgnoreRule(cwd, args) {
  const parsed = parseIgnoreRuleArgs(args);
  const rule = parsed.rule;
  if (!rule) throw new Error(`Pass a rule id, e.g. ${IMPECCABLE_COMMAND} hooks ignore-rule side-tab`);
  if (rule === 'overused-font' && !parsed.allValues) {
    throw new Error(`overused-font is value-specific by default. Use ${IMPECCABLE_COMMAND} hooks ignore-value overused-font <font> for a confirmed font, or ${IMPECCABLE_COMMAND} hooks ignore-rule overused-font --all-values only when the user asked to ignore overused fonts generally.`);
  }
  const config = mergeDetectorConfig(readRawDetectorConfig(cwd));
  if (!config.ignoreRules.includes(rule)) config.ignoreRules.push(rule);
  writeDetectorConfig(cwd, config);
  return `Added "${rule}" to detector.ignoreRules. Current: ${config.ignoreRules.join(', ')}`;
}

function parseIgnoreFileArgs(args) {
  const positionals = [];
  let shared = false;
  let local = false;

  for (const raw of args) {
    const arg = String(raw || '');
    if (arg === '--shared') {
      shared = true;

View on GitHub (pinned to f88b2837a7)