pbakaus/impeccable · error · Error

${arg} requires a glob

Error message

${arg} requires a glob

What it means

Thrown by parseIgnoreValueArgs() when `--file` or `--files` is the very last argument (no token follows it at all). Distinct from the empty-glob case: here there is no next value to inspect, so Impeccable refuses rather than reading past the end.

Source

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

  let local = false;
  let reason = '';

  for (let i = 0; i < args.length; i++) {
    const arg = String(args[i] || '');
    if (arg === '--shared') {
      shared = true;
    } else if (arg === '--local') {
      local = true;
    } else if (arg === '--reason') {
      const chunks = [];
      while (i + 1 < args.length && !String(args[i + 1]).startsWith('--')) {
        chunks.push(args[++i]);
      }
      reason = chunks.join(' ').trim();
    } else if (arg.startsWith('--reason=')) {
      reason = arg.slice('--reason='.length).trim();
    } else if (arg === '--file' || arg === '--files') {
      if (i + 1 >= args.length) throw new Error(`${arg} requires a glob`);
      files.push(requireGlob(args[++i], arg));
    } else if (arg.startsWith('--file=')) {
      files.push(requireGlob(arg.slice('--file='.length), '--file'));
    } else if (arg.startsWith('--files=')) {
      files.push(requireGlob(arg.slice('--files='.length), '--files'));
    } else if (arg.startsWith('--')) {
      // Otherwise a typo folds into the value: `ignore-value overused-font Inter
      // --shard` stored the value "inter --shard", which matches no finding, and
      // reported success. Matches `impeccable ignores add-value`.
      throw new Error(`Unknown ignore-value flag: ${arg}`);
    } else {
      positionals.push(arg);
    }
  }

  const [rule, ...valueParts] = positionals;
  return {
    rule: String(rule || '').trim().toLowerCase(),

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Append a glob after the flag: `... --file "src/widget.css"`.
  2. Switch to the equals form `--file="src/widget.css"` so a missing value is caught earlier and unambiguously.
  3. Audit the script/alias that builds the command to confirm the glob token is always emitted after --file.

Example fix

// before
impeccable hooks ignore-value overused-font Inter --file
// after
impeccable hooks ignore-value overused-font Inter --file "src/widget.css"
Defensive patterns

Strategy: validation

Validate before calling

// Ensure --file is never the last token.
const i = args.indexOf('--file');
if (i !== -1 && (i + 1 >= args.length || String(args[i + 1]).startsWith('--'))) {
  throw new Error('--file must be followed by a glob');
}

Type guard

function hasValueAfter(args, flag) {
  const i = args.indexOf(flag);
  return i !== -1 && i + 1 < args.length && !String(args[i + 1]).startsWith('--');
}

Prevention

When it happens

Trigger: A command that ends in `--file` or `--files` with nothing after it, e.g. `impeccable hooks ignore-value overused-font Inter --file`.

Common situations: Truncated command (terminal line-wrap, copy-paste cut off), or a script that conditionally appends `--file` but forgets to append the value.

Related errors


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