{"record":{"id":"b6516c3506844b7c","repo":"pbakaus/impeccable","slug":"arg-requires-a-glob","errorCode":null,"errorMessage":"${arg} requires a glob","messagePattern":"(.+?) requires a glob","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/skills/impeccable/scripts/hook-admin.mjs","lineNumber":665,"sourceCode":"  let local = false;\n  let reason = '';\n\n  for (let i = 0; i < args.length; i++) {\n    const arg = String(args[i] || '');\n    if (arg === '--shared') {\n      shared = true;\n    } else if (arg === '--local') {\n      local = true;\n    } else if (arg === '--reason') {\n      const chunks = [];\n      while (i + 1 < args.length && !String(args[i + 1]).startsWith('--')) {\n        chunks.push(args[++i]);\n      }\n      reason = chunks.join(' ').trim();\n    } else if (arg.startsWith('--reason=')) {\n      reason = arg.slice('--reason='.length).trim();\n    } else if (arg === '--file' || arg === '--files') {\n      if (i + 1 >= args.length) throw new Error(`${arg} requires a glob`);\n      files.push(requireGlob(args[++i], arg));\n    } else if (arg.startsWith('--file=')) {\n      files.push(requireGlob(arg.slice('--file='.length), '--file'));\n    } else if (arg.startsWith('--files=')) {\n      files.push(requireGlob(arg.slice('--files='.length), '--files'));\n    } else if (arg.startsWith('--')) {\n      // Otherwise a typo folds into the value: `ignore-value overused-font Inter\n      // --shard` stored the value \"inter --shard\", which matches no finding, and\n      // reported success. Matches `impeccable ignores add-value`.\n      throw new Error(`Unknown ignore-value flag: ${arg}`);\n    } else {\n      positionals.push(arg);\n    }\n  }\n\n  const [rule, ...valueParts] = positionals;\n  return {\n    rule: String(rule || '').trim().toLowerCase(),","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/hook-admin.mjs#L647-L683","documentation":"In parseIgnoreValueArgs(), `--file` / `--files` consume the next argv token as a glob. If either flag is the LAST token in argv, there is no following token to consume (i + 1 >= args.length), and the parser throws before calling requireGlob. This is the 'flag present but no value supplied' case, distinct from error 31 (value supplied but empty) and error 32 (value supplied but is a flag).","triggerScenarios":"Ending the command with a dangling `--file` or `--files`, e.g. `ignore-value r v --file`.","commonSituations":"Trailing flag with no argument; a script that appends `--file` conditionally but drops its value.","solutions":["Follow --file/--files with a glob token.","If building argv programmatically, ensure every --file is paired with a value before joining."],"exampleFix":"# before\nimpeccable hooks ignore-value r v --file\n\n# after\nimpeccable hooks ignore-value r v --file \"src/widget.js\"","handlingStrategy":"validation","validationCode":"for (let i = 0; i < args.length; i++) {\n  if ((args[i] === '--file' || args[i] === '--files') && i + 1 >= args.length) {\n    throw new Error(`${args[i]} requires a glob`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never end an argv with a dangling --file/--files.","When building argv programmatically, pair every --file with its value before joining."],"tags":["cli","argument-parsing","detector-config"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}