{"record":{"id":"006c9edc3e4a69a5","repo":"santifer/career-ops","slug":"unknown-option-arg-006c9e","errorCode":null,"errorMessage":"unknown option: ${arg}","messagePattern":"unknown option: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"verify-cv-facts.mjs","lineNumber":898,"sourceCode":"\n/** Parse the fact-validator command-line arguments. */\nfunction parseCliArgs(args) {\n  const sourcePaths = [];\n  let targetArg = '';\n  let configPath = DEFAULT_CONFIG;\n  let json = false;\n  for (let i = 0; i < args.length; i++) {\n    const arg = args[i];\n    if (arg === '--source' || arg === '--config') {\n      if (!args[i + 1]) throw new Error(`${arg} requires a path`);\n      if (arg === '--source') sourcePaths.push(args[++i]);\n      else configPath = args[++i];\n    } else if (arg === '--help' || arg === '-h') {\n      return { help: true };\n    } else if (arg === '--json') {\n      json = true;\n    } else if (arg.startsWith('--')) {\n      throw new Error(`unknown option: ${arg}`);\n    } else if (!targetArg) {\n      targetArg = arg;\n    } else {\n      throw new Error(`unexpected extra positional argument: ${arg}`);\n    }\n  }\n  return { targetArg, sourcePaths, configPath, json, help: false };\n}\n\n/** Return the command-line usage text. */\nfunction usage() {\n  return `Usage: node verify-cv-facts.mjs <generated-document> [--source path] [--config path] [--json]\n       node verify-cv-facts.mjs --self-test\n\nChecks generated candidate-facing text for unsupported metrics and explicitly asserted\nnon-metric facts (employers, titles, tools, and delegated-work authorship) absent\nfrom source files.\nDefault sources: cv.md, article-digest.md","sourceCodeStart":880,"sourceCodeEnd":916,"githubUrl":"https://github.com/santifer/career-ops/blob/e7abd431fce9348a95261acac9e0c14779c35df8/verify-cv-facts.mjs#L880-L916","documentation":"CLI argument validation in verify-cv-facts.mjs's parseCliArgs: a token starting with \"--\" matched none of the recognized options (--source, --config, --help/-h, --json). The interpolated value is the unrecognized flag itself; the input at fault is that command-line argument.","triggerScenarios":"Passing an unrecognized flag such as --sources (typo), --out, or a flag borrowed from another tool (e.g. --verbose) to verify-cv-facts.mjs.","commonSituations":"Typos and plural/singular mix-ups (--sources vs --source); assuming flags from a different validator script work here; copy-pasting a command line from another project's docs.","solutions":["Run node verify-cv-facts.mjs --help to list the supported flags","Fix the flag spelling — e.g. --sources is not valid, use --source (repeatable)","Remove flags that this script does not support"],"exampleFix":"// before\n$ node verify-cv-facts.mjs cv.md --sources a.md\n// after\n$ node verify-cv-facts.mjs cv.md --source a.md","handlingStrategy":"validation","validationCode":"const KNOWN = new Set(['--source','--config','--help','-h','--json']);\nconst unknown = args.filter(a => a.startsWith('--') && !KNOWN.has(a));\nif (unknown.length) { console.error(`unknown option(s): ${unknown.join(' ')}`); process.exit(2); }","typeGuard":null,"tryCatchPattern":"try {\n  const parsed = parseCliArgs(process.argv.slice(2));\n} catch (err) {\n  if (err.message.startsWith('unknown option')) {\n    console.error(`${err.message} — run with --help for valid flags`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Check --help before inventing flag names","Don't copy flags from other tools; each script has its own surface","Watch singular/plural: this script uses --source, not --sources","Wrap repeated invocations in a shell function so flag typos get fixed once"],"tags":["cli","argument-parsing"],"backgroundTag":"invalid-cli-argument","analyzedSha":"e7abd431fce9348a95261acac9e0c14779c35df8","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}