pbakaus/impeccable · error
${flag} requires a non-empty glob
Error message
${flag} requires a non-empty glob What it means
requireGlob() trims its input and rejects an empty result. It guards the `--file=` / `--files=` forms (and the space-separated `--file` form) against an empty value. Historically an empty glob was dropped by filter(Boolean), so `--file=` reported success while storing an entry scoped to no files — effectively a silent project-wide suppression. The guard makes that an explicit error.
Source
Thrown at plugin/skills/impeccable/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
- Supply a real glob, e.g. `--file "src/widget.js"`.
- If the glob comes from a variable, guard the whole call so the flag is omitted when the variable is empty rather than passed empty.
Example fix
# before impeccable hooks ignore-value r v --file= # after impeccable hooks ignore-value r v --file "src/widget.js"
Defensive patterns
Strategy: validation
Validate before calling
function requireGlob(raw, flag) {
const glob = String(raw ?? '').trim();
if (!glob) throw new Error(`${flag} requires a non-empty glob`);
return glob;
} Type guard
function isNonEmptyGlob(raw) {
return typeof raw === 'string' && raw.trim() !== '';
} Prevention
- Never pass an empty --file=/--files= value; guard variables before substitution.
- When templating, omit the --file flag entirely if its value is empty rather than passing --file=.
When it happens
Trigger: Passing `--file=` or `--files=` with nothing after the equals sign; passing `--file ""` (an explicitly empty quoted token).
Common situations: A shell variable that expanded to empty feeding `--file="$VAR"`; templated commands where the glob is conditionally empty.
Related errors
- overused-font is value-specific by default. Use ${IMPECCABLE
- --reason is not supported for ignore-file because detector.i
- Pass only one scope flag: --shared or --local
- ${flag} requires a glob, got the flag ${glob}
- ${arg} requires a glob
AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13).
Data as JSON: /api/errors/4e9eb8ee42eb8bc4.
Report an issue: GitHub.