{"record":{"id":"7f1c869bd79937f2","repo":"pbakaus/impeccable","slug":"unknown-argument-arg","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/github/sheriff.mjs","lineNumber":445,"sourceCode":"\n  for (let i = 0; i < argv.length; i += 1) {\n    const arg = argv[i];\n    if (arg === '--apply') options.apply = true;\n    else if (arg === '--dry-run') options.apply = false;\n    else if (arg === '--no-label-ensure') options.ensureLabels = false;\n    else if (arg === '--auto-close-regulars') options.autoCloseRegulars = true;\n    else if (arg === '--repo') options.repo = requireValue(argv, ++i, arg);\n    else if (arg === '--warning-days') options.warningDays = Number(requireValue(argv, ++i, arg));\n    else if (arg === '--close-days') options.closeDays = Number(requireValue(argv, ++i, arg));\n    else if (arg === '--maintainers') options.maintainers = splitList(requireValue(argv, ++i, arg));\n    else if (arg === '--regular-contributors') options.regularContributors = splitList(requireValue(argv, ++i, arg));\n    else if (arg === '--exempt-labels') options.exemptLabels = splitList(requireValue(argv, ++i, arg));\n    else if (arg === '--now') options.now = new Date(requireValue(argv, ++i, arg));\n    else if (arg === '--help' || arg === '-h') {\n      printHelp();\n      process.exit(0);\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  if (!Number.isFinite(options.warningDays) || options.warningDays < 0) {\n    throw new Error('--warning-days must be a non-negative number.');\n  }\n  if (!Number.isFinite(options.closeDays) || options.closeDays < options.warningDays) {\n    throw new Error('--close-days must be at least --warning-days.');\n  }\n  if (Number.isNaN(options.now.getTime())) throw new Error('--now must be a valid date.');\n\n  return options;\n}\n\nfunction latestMaintainerWaitCommand(pr, maintainers) {\n  return latestDate([\n    ...(pr.comments || [])\n      .filter((comment) => maintainers.has(normalizeLogin(comment.authorLogin)))","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/scripts/github/sheriff.mjs#L427-L463","documentation":"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).","triggerScenarios":"Passing any unrecognized flag such as `--verbsoe`, `--foo`, or a deprecated flag name to sheriff.","commonSituations":"Typo in a flag name, using a flag from a different tool, or version skew after a flag was renamed/removed.","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."],"exampleFix":"# before\nnode sheriff.mjs --verbsoe-days 5\n\n# after\nnode sheriff.mjs --warning-days 5","handlingStrategy":"validation","validationCode":"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']);\nfunction isKnownFlag(arg) {\n  return !arg.startsWith('--') || KNOWN_FLAGS.has(arg);\n}","typeGuard":"function isRecognizedFlag(arg) {\n  return !arg.startsWith('--') || KNOWN_FLAGS.has(arg) || arg.startsWith('--target');\n}","tryCatchPattern":"for (const arg of argv) {\n  if (arg.startsWith('--') && !KNOWN_FLAGS.has(arg)) {\n    console.error(`Unknown argument: ${arg}`);\n    process.exit(2);\n  }\n}","preventionTips":["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."],"tags":["cli","sheriff","argv","validation"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}