pbakaus/impeccable · error · Error

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

Error message

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

What it means

Thrown by parseIgnoreFileArgs when both --shared and --local are passed. ignore-file writes to exactly one config file: shared detector config or local (gitignored) detector config. Passing both is ambiguous, so the parser refuses rather than guessing a precedence. When neither is given, shared is the default.

Source

Thrown at skill/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 of --shared or --local.
  2. If unsure, omit both — the default is shared (committed) config.
  3. Use --local only when the suppression should stay on your machine and not be committed.

Example fix

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

# after (pick one; default is shared)
impeccable hooks ignore-file "src/legacy/**" --shared
# or keep it machine-local:
impeccable hooks ignore-file "src/legacy/**" --local
Defensive patterns

Strategy: validation

Validate before calling

// Enforce mutual exclusivity of scope flags before parsing further.
function ensureSingleScope({ shared, local }) {
  if (shared && local) {
    throw new Error('Pass only one scope flag: --shared or --local');
  }
}

Prevention

When it happens

Trigger: Passing `--shared --local` together; a wrapper script that forwards both flags unconditionally; copy-pasting a command and appending the other scope.

Common situations: A user unsure which scope they want and hedging; automation that sets both to 'be safe'; misunderstanding that local is the gitignored override of shared.

Related errors


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