pbakaus/impeccable · error · Error

${flag} requires a non-empty glob

Error message

${flag} requires a non-empty glob

What it means

Thrown by requireGlob() in skill/scripts/hook-admin.mjs when an ignore-value/ignore-rule file-scope flag (--file / --files / --file=) is given an empty or whitespace-only glob. Impeccable refuses empty globs because an older version silently dropped them via filter(Boolean), writing a suppression entry with no files and giving the user project-wide suppression instead of a one-file scope.

Source

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

}

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(', ')}`;
}

// An empty glob used to be dropped by filter(Boolean), so `--file=` reported
// success and wrote an entry with no files: the user asked to scope a rule to one
// file and silently got the project-wide suppression instead. Refuse it.
function requireGlob(raw, flag) {
  const glob = String(raw ?? '').trim();
  if (!glob) throw new Error(`${flag} requires a non-empty glob`);
  // A following flag is not a glob. `--file --reason "why"` consumed `--reason`
  // as the scope and left the reason text to fold into the value, storing
  // value="* why" files=["--reason"] and reporting success. Same silent-no-op
  // class as an unknown flag folding into the value; refuse it the same way.
  if (glob.startsWith('--')) throw new Error(`${flag} requires a glob, got the flag ${glob}`);
  return glob;
}

function parseIgnoreValueArgs(args) {
  const positionals = [];
  const files = [];
  let shared = false;
  let local = false;
  let reason = '';

  for (let i = 0; i < args.length; i++) {
    const arg = String(args[i] || '');
    if (arg === '--shared') {

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Supply a non-empty glob after --file, e.g. `--file "src/widget.css"` or `--file "src/**/*.css"`.
  2. If the path comes from a shell variable, guard it first: `[ -n "$FILE" ] && ... --file "$FILE"`.
  3. For a single file use its concrete path; for a group use a brace/asterisk glob quoted to prevent shell expansion.

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

// Before building the CLI args, ensure the glob is a non-empty string.
function buildFileArg(glob) {
  if (typeof glob !== 'string' || glob.trim() === '' || glob.startsWith('--')) {
    throw new Error(`Refusing to emit --file with invalid glob: ${JSON.stringify(glob)}`);
  }
  return ['--file', glob];
}

Type guard

function isValidGlob(v) {
  return typeof v === 'string' && v.trim() !== '' && !v.trim().startsWith('--');
}

Prevention

When it happens

Trigger: Calling `impeccable hooks ignore-value <rule> <value> --file=` (trailing equals, no value), `--file ""`, `--file " "`, or `--file` as the last argument with nothing after it. Also `--files=` empty.

Common situations: Shell quoting mistakes where a variable expands to empty (`--file="$MY_FILE"` with MY_FILE unset), copy-pasting a command and deleting the path, or scripting the CLI without checking that the glob variable is set.

Related errors


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