{"record":{"id":"2b61192ee1e357df","repo":"vercel/next.js","slug":"invalid-numeric-value-for-key-value-2b6119","errorCode":null,"errorMessage":"Invalid numeric value for --${key}: ${value}","messagePattern":"Invalid numeric value for --(.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/render-pipeline/client-trace.ts","lineNumber":117,"sourceCode":"      documentLoaderURL?: string\n    }\n  }\n}\n\nfunction parseBoolean(value: string): boolean {\n  return value === '1' || value === 'true' || value === 'yes'\n}\n\nfunction parseNumberArg(\n  args: Map<string, string>,\n  key: string,\n  fallback: number\n): number {\n  const value = args.get(key)\n  if (value === undefined) return fallback\n  const parsed = Number(value)\n  if (!Number.isFinite(parsed)) {\n    throw new Error(`Invalid numeric value for --${key}: ${value}`)\n  }\n  return parsed\n}\n\nfunction usage() {\n  console.log(`Usage: pnpm bench:render-pipeline:client [options]\n\nOptions:\n  --app-dir=<path>            (default: bench/basic-app)\n  --routes=/,/dashboard,...   (default: /,/dashboard,/docs,/blog,/tailwind)\n  --samples=<number>          (default: 3)\n  --cpu-throttle=<number>     (default: 4) CDP CPU throttling rate\n  --build=true|false          (default: false) build the fixture first\n  --start-server=true|false   (default: true) set false to attach to a\n                              server already running on --port\n  --port=<number>             (default: 3199)\n  --timeout-ms=<number>       (default: 30000)\n  --settle-ms=<number>        (default: 750) post-hydration wait so","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/render-pipeline/client-trace.ts#L99-L135","documentation":"Thrown by parseNumberArg in the client-trace CLI when a numeric flag (--samples, --cpu-throttle, --port, --timeout-ms, --settle-ms) receives a value that Number() parses to NaN or Infinity. This is a CLI argument validation guard that fails fast with a precise message instead of letting a non-finite number propagate into Chrome DevTools Protocol calls or fetch logic.","triggerScenarios":"Passing --samples=abc, --port=:3000, --cpu-throttle=fast, an empty value like --samples=, or a value with stray characters.","commonSituations":"Typo in a flag value; copy-pasting a URL-style port; passing a unit suffix the parser does not strip; shell quoting that drops the value.","solutions":["Pass a plain finite integer for the flagged option, e.g. --samples=3.","Re-run with --help to see the expected value types for each flag.","Check shell quoting if the value comes from a variable."],"exampleFix":"// before\n--port=:3199\n// after\n--port=3199","handlingStrategy":"validation","validationCode":"// Validate numeric CLI args before passing them\nfunction assertFiniteInt(label: string, v: unknown): number {\n  const n = Number(v)\n  if (!Number.isFinite(n)) throw new Error(`--${label} must be a finite number, got ${v}`)\n  return n\n}","typeGuard":"const isFiniteNumber = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v)","tryCatchPattern":"null","preventionTips":["Pass plain integers to numeric flags.","Use --help to confirm expected value types.","If interpolating from env, validate before constructing the CLI string."],"tags":["cli","validation","argument-parsing"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}