{"record":{"id":"b31405a59fc79ade","repo":"stablyai/orca","slug":"invalid-key-options-key","errorCode":null,"errorMessage":"Invalid --${key}: ${options[key]}","messagePattern":"Invalid --(.+?): (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-idle-cpu-benchmark.mjs","lineNumber":115,"sourceCode":"      process.exit(0)\n    } else {\n      throw new Error(`Unknown argument: ${arg}`)\n    }\n  }\n  for (const key of [\n    'warmupMs',\n    'sampleMs',\n    'intervalMs',\n    'worktrees',\n    'lineageDepth',\n    'agentsPerWorktree',\n    'zustandPublications',\n    'zustandPublicationIntervalMs',\n    'syntheticVisibleSpinners',\n    'syntheticSpinnerSteps'\n  ]) {\n    if (!Number.isFinite(options[key]) || options[key] < 0) {\n      throw new Error(`Invalid --${key}: ${options[key]}`)\n    }\n  }\n  options.worktrees = Math.max(1, Math.floor(options.worktrees))\n  options.intervalMs = Math.max(250, Math.floor(options.intervalMs))\n  options.lineageDepth = Math.floor(options.lineageDepth)\n  options.agentsPerWorktree = Math.floor(options.agentsPerWorktree)\n  options.zustandPublications = Math.floor(options.zustandPublications)\n  options.zustandPublicationIntervalMs = Math.max(\n    1,\n    Math.floor(options.zustandPublicationIntervalMs)\n  )\n  options.syntheticVisibleSpinners = Math.max(0, Math.floor(options.syntheticVisibleSpinners))\n  options.syntheticSpinnerSteps = Math.max(1, Math.floor(options.syntheticSpinnerSteps))\n  if (!['smooth', 'steps'].includes(options.syntheticSpinnerAnimation)) {\n    throw new Error(`Invalid --synthetic-spinner-animation: ${options.syntheticSpinnerAnimation}`)\n  }\n  if (options.lineageDepth > 0 && options.worktrees < 2) {\n    throw new Error('--lineage-depth requires at least two --worktrees')","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-idle-cpu-benchmark.mjs#L97-L133","documentation":"Thrown by the post-parse validation loop in parseArgs when any numeric option (warmupMs, sampleMs, intervalMs, worktrees, lineageDepth, agentsPerWorktree, zustandPublications, zustandPublicationIntervalMs, syntheticVisibleSpinners, syntheticSpinnerSteps) is non-finite or negative. Number() on garbage or empty yields NaN, which Number.isFinite rejects.","triggerScenarios":"Passing a non-numeric value to a numeric flag ('--warmup-ms abc', '--worktrees <empty>'), a negative number, or Infinity/NaN from an expression.","commonSituations":"Shell-expanding an unset variable to empty (Number('') === 0 is fine, but Number('abc') is NaN), passing floats where integers are expected after flooring still validates first, copy-pasting units ('5000ms').","solutions":["Provide a non-negative number (integer or decimal; later floored) for the flagged option.","Strip units/quotes from shell-passed values.","Default unset numeric env-like values rather than passing empty strings."],"exampleFix":"# before\nnode config/scripts/run-idle-cpu-benchmark.mjs --warmup-ms abc\n# after\nnode config/scripts/run-idle-cpu-benchmark.mjs --warmup-ms 15000","handlingStrategy":"validation","validationCode":"const NUMERIC_KEYS = ['warmupMs','sampleMs','intervalMs','worktrees','lineageDepth','agentsPerWorktree','zustandPublications','zustandPublicationIntervalMs','syntheticVisibleSpinners','syntheticSpinnerSteps']\nfor (const key of NUMERIC_KEYS) {\n  if (!Number.isFinite(options[key]) || options[key] < 0) {\n    throw new Error(`Invalid --${key}: ${options[key]}`)\n  }\n}","typeGuard":"function isNonNegativeNumber(value) {\n  return typeof value === 'number' && Number.isFinite(value) && value >= 0\n}","tryCatchPattern":"try {\n  options = parseArgs(argv)\n} catch (err) {\n  if (/^Invalid --/.test(err.message)) { printUsage(); process.exit(2) }\n  throw err\n}","preventionTips":["Coerce inputs with Number() and reject NaN before assignment.","Reject units ('ms', 's') at parse time with a clear message.","Document each numeric flag's unit and bounds in --help."],"tags":["cli","validation","numbers","benchmark"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}