pbakaus/impeccable · error · Error
Unknown argument: ${arg}
Error message
Unknown argument: ${arg} What it means
Thrown by sheriff.mjs parseArgs when an argv token starts with -- but is not one of the recognized flags. The parser is strict so a typo does not silently change behavior (e.g. a misspelled flag being treated as inert).
Source
Thrown at scripts/github/sheriff.mjs:445
for (let i = 0; i < argv.length; i += 1) {
const arg = argv[i];
if (arg === '--apply') options.apply = true;
else if (arg === '--dry-run') options.apply = false;
else if (arg === '--no-label-ensure') options.ensureLabels = false;
else if (arg === '--auto-close-regulars') options.autoCloseRegulars = true;
else if (arg === '--repo') options.repo = requireValue(argv, ++i, arg);
else if (arg === '--warning-days') options.warningDays = Number(requireValue(argv, ++i, arg));
else if (arg === '--close-days') options.closeDays = Number(requireValue(argv, ++i, arg));
else if (arg === '--maintainers') options.maintainers = splitList(requireValue(argv, ++i, arg));
else if (arg === '--regular-contributors') options.regularContributors = splitList(requireValue(argv, ++i, arg));
else if (arg === '--exempt-labels') options.exemptLabels = splitList(requireValue(argv, ++i, arg));
else if (arg === '--now') options.now = new Date(requireValue(argv, ++i, arg));
else if (arg === '--help' || arg === '-h') {
printHelp();
process.exit(0);
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
if (!Number.isFinite(options.warningDays) || options.warningDays < 0) {
throw new Error('--warning-days must be a non-negative number.');
}
if (!Number.isFinite(options.closeDays) || options.closeDays < options.warningDays) {
throw new Error('--close-days must be at least --warning-days.');
}
if (Number.isNaN(options.now.getTime())) throw new Error('--now must be a valid date.');
return options;
}
function latestMaintainerWaitCommand(pr, maintainers) {
return latestDate([
...(pr.comments || [])
.filter((comment) => maintainers.has(normalizeLogin(comment.authorLogin)))View on GitHub (pinned to d14711ae3d)
Solutions
- Check the flag spelling against parseArgs' recognized list (--apply, --dry-run, --repo, --warning-days, --close-days, --maintainers, --regular-contributors, --exempt-labels, --now, --auto-close-regulars, --no-label-ensure, --help/-h).
- Run `sheriff.mjs --help` to confirm the supported flags.
- Remove the stray flag from your wrapper script.
Example fix
# before node sheriff.mjs --verbsoe-days 5 # after node sheriff.mjs --warning-days 5
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN_FLAGS = new Set(['--apply','--dry-run','--no-label-ensure','--auto-close-regulars','--repo','--warning-days','--close-days','--maintainers','--regular-contributors','--exempt-labels','--now','--help','-h']);
function isKnownFlag(arg) {
return !arg.startsWith('--') || KNOWN_FLAGS.has(arg);
} Type guard
function isRecognizedFlag(arg) {
return !arg.startsWith('--') || KNOWN_FLAGS.has(arg) || arg.startsWith('--target');
} Try / catch
for (const arg of argv) {
if (arg.startsWith('--') && !KNOWN_FLAGS.has(arg)) {
console.error(`Unknown argument: ${arg}`);
process.exit(2);
}
} Prevention
- Keep a single KNOWN_FLAGS set and document it in --help.
- When renaming a flag, accept the old name for a release with a deprecation warning.
- Run sheriff with --help first when unsure of the flag set.
When it happens
Trigger: Passing any unrecognized flag such as `--verbsoe`, `--foo`, or a deprecated flag name to sheriff.
Common situations: Typo in a flag name, using a flag from a different tool, or version skew after a flag was renamed/removed.
Related errors
- --warning-days must be a non-negative number.
- --close-days must be at least --warning-days.
- --now must be a valid date.
- ${flag} requires a value.
- --target requires a path value (use --target <path> or --tar
AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13).
Data as JSON: /api/errors/7f1c869bd79937f2.
Report an issue: GitHub.