pbakaus/impeccable · error

Pass exactly one glob to ignore-file

Error message

Pass exactly one glob to ignore-file

What it means

Thrown by parseIgnoreFileArgs when more than one positional argument is given to `hooks ignore-file`. detector.ignoreFiles stores a list of independent globs, but the command is designed to add exactly one per invocation so its output message ('Added ...') stays truthful; multiple positionals indicate the user thinks they are scoping one entry to several files, which is ignore-value --file semantics, not ignore-file.

Source

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

  let local = false;

  for (const raw of args) {
    const arg = String(raw || '');
    if (arg === '--shared') {
      shared = true;
    } else if (arg === '--local') {
      local = true;
    } else if (arg === '--reason' || arg.startsWith('--reason=')) {
      throw new Error('--reason is not supported for ignore-file because detector.ignoreFiles stores globs only; use ignore-value when a documented rule-specific exception fits');
    } else if (arg.startsWith('--')) {
      throw new Error(`Unknown ignore-file flag: ${arg}`);
    } else {
      positionals.push(arg);
    }
  }

  if (shared && local) throw new Error('Pass only one scope flag: --shared or --local');
  if (positionals.length > 1) throw new Error('Pass exactly one glob to ignore-file');

  return {
    glob: positionals[0],
    local,
  };
}

function addIgnoreFile(cwd, args) {
  const parsed = parseIgnoreFileArgs(args);
  const glob = parsed.glob;
  if (!glob) throw new Error(`Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file "src/legacy/**"`);
  const config = mergeDetectorConfig(readRawDetectorConfig(cwd, { local: parsed.local }));
  if (!config.ignoreFiles.includes(glob)) config.ignoreFiles.push(glob);
  const target = writeDetectorConfig(cwd, config, { local: parsed.local });
  const scope = parsed.local ? 'local detector.ignoreFiles' : 'shared detector.ignoreFiles';
  return `Added "${glob}" to ${scope} (${path.relative(cwd, target) || target}). Current: ${config.ignoreFiles.join(', ')}`;
}

View on GitHub (pinned to f88b2837a7)

Solutions

  1. Quote the glob so the script receives one argument: `hooks ignore-file "src/*.css"`.
  2. Run the command once per glob if you genuinely want several entries.
  3. Combine patterns into a single glob such as "{src,lib}/**/*.css" when they share shape.

Example fix

# before (shell expands *.css into many args)
impeccable hooks ignore-file src/*.css

# after
impeccable hooks ignore-file "src/*.css"
Defensive patterns

Strategy: validation

Validate before calling

const globs = rawArgs.filter(a => !a.startsWith('--'));
if (globs.length > 1) throw new Error('one glob per invocation');
const [cmdGlob] = globs;
spawnSync('impeccable', ['hooks', 'ignore-file', cmdGlob, ...scopeFlags]);

Prevention

When it happens

Trigger: `hooks ignore-file src/a.css src/b.css`; `hooks ignore-file "src/*.css" "lib/*.css"`; an unquoted glob expanded by the shell into many path arguments before the script sees it.

Common situations: Shell glob expansion (forgetting to quote) turning one pattern into many concrete paths; users trying to scope a suppression to a file list in one shot.

Related errors


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