{"record":{"id":"98bdf2cb203648de","repo":"chenglou/pretext","slug":"invalid-value-for-name-raw-98bdf2","errorCode":null,"errorMessage":"Invalid value for --${name}: ${raw}","messagePattern":"Invalid value for --(.+?): (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/symbol-check.ts","lineNumber":55,"sourceCode":"  requestId?: string\n  results?: Array<{\n    label: string\n    report: ProbeReport\n  }>\n  message?: string\n}\n\nfunction parseStringFlag(name: string): string | null {\n  const prefix = `--${name}=`\n  const arg = process.argv.find(value => value.startsWith(prefix))\n  return arg === undefined ? null : arg.slice(prefix.length)\n}\n\nfunction parseNumberFlag(name: string, fallback: number): number {\n  const raw = parseStringFlag(name)\n  if (raw === null) return fallback\n  const parsed = Number.parseInt(raw, 10)\n  if (!Number.isFinite(parsed)) throw new Error(`Invalid value for --${name}: ${raw}`)\n  return parsed\n}\n\nfunction parseBrowsers(value: string | null): AutomationBrowserKind[] {\n  const raw = (value ?? 'chrome,safari').trim()\n  if (raw.length === 0) return ['chrome', 'safari']\n\n  const browsers = raw\n    .split(',')\n    .map(part => part.trim().toLowerCase())\n    .filter(Boolean)\n\n  for (const browser of browsers) {\n    if (browser !== 'chrome' && browser !== 'safari' && browser !== 'firefox') {\n      throw new Error(`Unsupported browser ${browser}`)\n    }\n  }\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/symbol-check.ts#L37-L73","documentation":"Identical helper shape to error 81, here in scripts/symbol-check.ts. parseNumberFlag guards --port (line 77) and --timeout (line 79, default 60000). Throws when Number.parseInt(raw, 10) is NaN. Called at module top-level, so it aborts before any browser automation starts. Note parseInt tolerates surrounding whitespace, so '8080 ' is fine, but '8080px' throws.","triggerScenarios":"--port=abc; --timeout=10s; --port= (empty). --timeout is milliseconds, so '30s' is a common mistake.","commonSituations":"Copy-pasting units into --timeout (30s instead of 30000); empty --port=; forgetting --timeout is in ms.","solutions":["Use plain integers: --port=0, --timeout=60000 (milliseconds).","Remember --timeout is milliseconds, not seconds.","The message names the bad flag and shows the raw value."],"exampleFix":"# before\nbun run scripts/symbol-check.ts --timeout=30s\n\n# after\nbun run scripts/symbol-check.ts --timeout=30000","handlingStrategy":"validation","validationCode":"const isIntFlag = (raw: string | null): boolean =>\n  raw === null || /^-?\\d+$/.test(raw.trim())\nfor (const name of ['port', 'timeout'] as const) {\n  const raw = parseStringFlag(name)\n  if (!isIntFlag(raw)) {\n    console.error(`--${name} expects an integer (ms for timeout), got ${JSON.stringify(raw)}`)\n    process.exit(2)\n  }\n}","typeGuard":"const isIntFlag = (s: string | null): s is string =>\n  s !== null && Number.isFinite(Number.parseInt(s, 10))","tryCatchPattern":null,"preventionTips":["--timeout is milliseconds; --port is unitless. Never append units like 's' or 'px'.","Validate before launch since these flags are read at module top-level and abort early."],"tags":["cli","argument-parsing","typescript"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}