{"record":{"id":"61b48fd2cffa7980","repo":"vercel/next.js","slug":"unknown-option-rawkey","errorCode":null,"errorMessage":"Unknown option: --${rawKey}","messagePattern":"Unknown option: --(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/dev-validation/benchmark.ts","lineNumber":121,"sourceCode":"        opts.bundler = value === 'webpack' ? 'webpack' : 'turbopack'\n        break\n      case 'clicks':\n        opts.clicks = Number(value)\n        break\n      case 'port':\n        opts.port = Number(value)\n        break\n      case 'headless':\n        opts.headless = value !== 'false'\n        break\n      case 'settle-ms':\n        opts.settleMs = Number(value)\n        break\n      case 'json-out':\n        opts.jsonOut = value\n        break\n      default:\n        throw new Error(`Unknown option: --${rawKey}`)\n    }\n  }\n  return opts\n}\n\nfunction stats(samples: number[]): Stats {\n  if (samples.length === 0) {\n    return { n: 0, p50: NaN, p95: NaN, max: NaN, mean: NaN }\n  }\n  const sorted = [...samples].sort((a, b) => a - b)\n  const at = (p: number) =>\n    sorted[Math.min(sorted.length - 1, Math.floor((p / 100) * sorted.length))]\n  const mean = sorted.reduce((a, b) => a + b, 0) / sorted.length\n  return {\n    n: sorted.length,\n    p50: Math.round(at(50)),\n    p95: Math.round(at(95)),\n    max: Math.round(sorted[sorted.length - 1]),","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/dev-validation/benchmark.ts#L103-L139","documentation":"Thrown by parseArgs (benchmark.ts:121) when a CLI token's key does not match any recognized flag for the dev-validation benchmark. The benchmark only accepts --compare, --worker, --bundler, --clicks, --port, --headless, --settle-ms, --json-out (and --help via the slice loop), so anything else hits the default case. It fails fast so typos don't silently change benchmark behavior.","triggerScenarios":"Running `pnpm bench:dev-validation` with a flag not in the allowlist above, e.g. --routes, --scenario, --timeout, or a misspelled flag like --cliks or --settleMs (note: this parser uses dashes, so --settleMs is unknown; only --settle-ms is valid).","commonSituations":"Copy-pasting flags from the render-pipeline benchmark (which has --routes, --scenario, etc.) into the dev-validation command; using camelCase instead of kebab-case; an outdated script alias passing a flag that was renamed/removed.","solutions":["Re-run with --help or read the parseArgs switch (benchmark.ts:93-119) to see the exact accepted keys.","Check spelling and casing: keys are kebab-case (--settle-ms, --json-out), not camelCase.","Don't carry over flags from bench/render-pipeline/benchmark.ts; these are two different benchmarks with different option sets.","If you genuinely need a new option, add a case to the switch; do not weaken the default throw."],"exampleFix":"// before: typos and wrong-flag-set invocations\n//   pnpm bench:dev-validation --settleMs=3000 --routes=/,/dashboard\n\n// after\n//   pnpm bench:dev-validation --settle-ms=3000","handlingStrategy":"validation","validationCode":"const ALLOWED_DEV_VALIDATION_FLAGS = new Set([\n  'compare', 'worker', 'bundler', 'clicks', 'port', 'headless', 'settle-ms', 'json-out', 'help', '',\n])\nfunction validateFlags(argv: string[]): string[] {\n  const bad = argv\n    .filter((a) => a.startsWith('--'))\n    .map((a) => a.replace(/^--/, '').split('=')[0])\n    .filter((k) => !ALLOWED_DEV_VALIDATION_FLAGS.has(k))\n  return bad\n}","typeGuard":"function isKnownDevValidationFlag(key: string): boolean {\n  return new Set(['compare','worker','bundler','clicks','port','headless','settle-ms','json-out','help']).has(key)\n}","tryCatchPattern":"// CLI parse failures are fatal by design; don't catch-and-continue. Instead, surface usage:\ntry {\n  parseArgs(process.argv.slice(2))\n} catch (err) {\n  console.error((err as Error).message)\n  console.error('Valid flags: --compare --worker --bundler --clicks --port --headless --settle-ms --json-out')\n  process.exit(2)\n}","preventionTips":["Use kebab-case for multi-word flags (--settle-ms, --json-out), never camelCase.","Don't reuse render-pipeline flags here; the two benchmarks have different option sets.","Run with --help to confirm the accepted set before scripting.","Keep wrapper scripts' flag list in sync with parseArgs when options change."],"tags":["cli","argument-parsing","dev-validation","benchmark","typo"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}