{"record":{"id":"2e50158a64a82569","repo":"chenglou/pretext","slug":"unsupported-browser-browser-expected-chrome-or","errorCode":null,"errorMessage":"Unsupported browser ${browser}; expected chrome or safari","messagePattern":"Unsupported browser (.+?); expected chrome or safari","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/benchmark-check.ts","lineNumber":92,"sourceCode":"  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)) {\n    throw new Error(`Invalid value for --${name}: ${raw}`)\n  }\n  return parsed\n}\n\nfunction parseBrowser(value: string | null): BrowserKind {\n  const browser = (value ?? process.env['BENCHMARK_CHECK_BROWSER'] ?? 'chrome').toLowerCase()\n  if (browser !== 'chrome' && browser !== 'safari') {\n    throw new Error(`Unsupported browser ${browser}; expected chrome or safari`)\n  }\n  return browser\n}\n\nfunction median(values: number[]): number {\n  const sorted = [...values].sort((a, b) => a - b)\n  const mid = Math.floor(sorted.length / 2)\n  return sorted.length % 2 === 0 ? (sorted[mid - 1]! + sorted[mid]!) / 2 : sorted[mid]!\n}\n\nfunction assertSame<T>(actual: T, expected: T, context: string): void {\n  if (actual === expected) return\n  throw new Error(\n    `Benchmark runs disagree for ${context}: expected ${String(expected)}, got ${String(actual)}`,\n  )\n}\n\nfunction medianBenchmarkResults(","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/benchmark-check.ts#L74-L110","documentation":"Thrown by parseBrowser() in benchmark-check.ts: the selected browser (from --browser= flag, else BENCHMARK_CHECK_BROWSER env, else default 'chrome') must be exactly 'chrome' or 'safari' (case-insensitive). The benchmark harness only implements Chrome and Safari automation paths; Firefox is unsupported here (unlike accuracy-check, which has a Firefox path). Any other value throws before any work begins.","triggerScenarios":"Passing --browser=firefox, --browser=edge, --browser=chromium (note: must be exactly 'chrome'), or exporting BENCHMARK_CHECK_BROWSER=opera. The comparison is lowercased, so 'Chrome' and 'SAFARI' are accepted.","commonSituations":"Assuming the benchmark supports the same browsers as accuracy-check (it does not support Firefox); using 'chromium' instead of 'chrome'; leaving BENCHMARK_CHECK_BROWSER set to a value from a different tool's config.","solutions":["Use --browser=chrome or --browser=safari.","Unset BENCHMARK_CHECK_BROWSER if you want the 'chrome' default.","For Firefox benchmarking, note it is intentionally unsupported — use accuracy-check instead or extend the harness.","Double-check spelling: 'chromium' and 'google-chrome' are rejected; only 'chrome' is accepted."],"exampleFix":"# before\nBENCHMARK_CHECK_BROWSER=firefox bun run scripts/benchmark-check.ts\n\n# after\nBENCHMARK_CHECK_BROWSER=chrome bun run scripts/benchmark-check.ts\n# or explicitly\nbun run scripts/benchmark-check.ts --browser=safari","handlingStrategy":"validation","validationCode":"// Validate browser selection before passing it in.\nconst SUPPORTED = new Set(['chrome', 'safari'])\nfunction parseBrowser(value: string | null): BrowserKind {\n  const browser = (value ?? process.env.BENCHMARK_CHECK_BROWSER ?? 'chrome').toLowerCase()\n  if (!SUPPORTED.has(browser)) {\n    throw new Error(`Unsupported browser ${browser}; expected chrome or safari`)\n  }\n  return browser as BrowserKind\n}","typeGuard":"function isSupportedBrowser(value: string): value is 'chrome' | 'safari' {\n  return value === 'chrome' || value === 'safari'\n}","tryCatchPattern":null,"preventionTips":["Remember the benchmark supports only chrome and safari; Firefox is accuracy-check-only.","Use exactly 'chrome', not 'chromium' or 'google-chrome'.","Unset BENCHMARK_CHECK_BROWSER if you want the default rather than a stale value."],"tags":["benchmark-check","config","browser-selection","validation"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}