pbakaus/impeccable · error

Pass only one scope flag: --shared or --local

Error message

Pass only one scope flag: --shared or --local

What it means

ignore-file's scope is a single choice: `--shared` writes to the committed detector config and `--local` writes to a gitignored local config. Setting both is contradictory, so the parser rejects it after collecting args. (This check is shared with ignore-value, which throws the identical message.)

Source

Thrown at plugin/skills/impeccable/scripts/hook-admin.mjs:609

  let shared = false;
  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 d14711ae3d)

Solutions

  1. Pass exactly one scope flag — either --shared or --local (or neither for the default).

Example fix

# before
impeccable hooks ignore-file "src/legacy/**" --shared --local

# after
impeccable hooks ignore-file "src/legacy/**" --shared
Defensive patterns

Strategy: validation

Validate before calling

if (args.includes('--shared') && args.includes('--local')) {
  throw new Error('Pass only one scope flag: --shared or --local');
}

Prevention

When it happens

Trigger: Running `hooks ignore-file "<glob>" --shared --local`.

Common situations: Passing both flags by mistake; a wrapper script that always appends a scope flag colliding with one the user also set.

Related errors


AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13). Data as JSON: /api/errors/0614a58ed675046c. Report an issue: GitHub.