pbakaus/impeccable · error
${flag} requires a glob, got the flag ${glob}
Error message
${flag} requires a glob, got the flag ${glob} What it means
requireGlob() rejects a value that is itself a flag (begins with `--`). This stops `--file --reason "why"` from consuming `--reason` as the glob, which previously stored value="* why", files=["--reason"] and reported success while matching nothing. Same silent-no-op class as an unknown flag folding into the value.
Source
Thrown at plugin/skills/impeccable/scripts/hook-admin.mjs:639
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') {
shared = true;
} else if (arg === '--local') {
local = true;
} else if (arg === '--reason') {
const chunks = [];View on GitHub (pinned to d14711ae3d)
Solutions
- Place a real glob immediately after --file, then other flags after it: `--file "src/widget.js" --reason "why"`.
Example fix
# before impeccable hooks ignore-value r v --file --reason "why" # after impeccable hooks ignore-value r v --file "src/widget.js" --reason "why"
Defensive patterns
Strategy: validation
Validate before calling
function requireGlob(raw, flag) {
const glob = String(raw ?? '').trim();
if (glob.startsWith('--')) throw new Error(`${flag} requires a glob, got the flag ${glob}`);
return glob;
} Type guard
function looksLikeFlag(v) {
return typeof v === 'string' && v.startsWith('--');
} Prevention
- Always place a real glob token immediately after --file/--files.
- Order flags so a glob never has to follow --file directly after another flag.
When it happens
Trigger: `--file` (or `--files`) immediately followed by another flag token such as `--reason`, `--shared`, or any `--foo`, because the next token is taken as the glob value.
Common situations: Ordering flags so a flag lands where a glob is expected; a wrapper that concatenates flags in the wrong order.
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 non-empty glob
- ${arg} requires a glob
AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13).
Data as JSON: /api/errors/9b4e97ba8c88b842.
Report an issue: GitHub.