{"record":{"id":"98789abfe1359296","repo":"chenglou/pretext","slug":"unsupported-browser-browser-expected-chrome-or-98789a","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/probe-check.ts","lineNumber":82,"sourceCode":"\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 parseBrowser(value: string | null): BrowserKind {\n  const browser = (value ?? process.env['PROBE_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 requireFlag(name: string): string {\n  const value = parseStringFlag(name)\n  if (value === null || value.length === 0) throw new Error(`Missing --${name}=...`)\n  return value\n}\n\nfunction printReport(report: ProbeReport): void {\n  if (report.status === 'error') {\n    console.log(`error: ${report.message ?? 'unknown error'}`)\n    return\n  }\n\n  console.log(\n    `width ${report.width}: diff ${report.diffPx}px | lines ${report.predictedLineCount}/${report.browserLineCount} | height ${report.predictedHeight}/${report.actualHeight}`,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/probe-check.ts#L64-L100","documentation":"parseBrowser constrains probe-check to Chrome or Safari. It reads --browser=, then the PROBE_CHECK_BROWSER env var, then defaults to 'chrome', lowercases, and throws for anything else (including firefox, edge, ie). probe-check is a focused single-case diagnostic; the broader Firefox/oracle automation lives in pre-wrap-check.ts and symbol-check.ts, and even there Firefox symbol runs are unsupported (see error 86).","triggerScenarios":"--browser=firefox; PROBE_CHECK_BROWSER=edge bun run scripts/probe-check.ts; a typo such as --browser=chrme. parseBrowser runs at line 145, before the browser session is created.","commonSituations":"Reusing a --browser=firefox habit from pre-wrap-check/symbol-check; a PROBE_CHECK_BROWSER env var left over from another tool; typo in the token.","solutions":["Use chrome (the default) or safari.","Unset or correct PROBE_CHECK_BROWSER if the throw names a value you did not pass on the CLI.","For Firefox diagnostics use the dedicated checkers (pre-wrap-check), not probe-check."],"exampleFix":"# before\nPROBE_CHECK_BROWSER=firefox bun run scripts/probe-check.ts --text=hi\n\n# after\nbun run scripts/probe-check.ts --text=hi                  # defaults to chrome\n# or\nbun run scripts/probe-check.ts --browser=safari --text=hi","handlingStrategy":"validation","validationCode":"const PROBE_BROWSERS = ['chrome', 'safari'] as const\nconst candidate = (parseStringFlag('browser') ?? process.env['PROBE_CHECK_BROWSER'] ?? 'chrome').toLowerCase()\nif (!PROBE_BROWSERS.includes(candidate as 'chrome' | 'safari')) {\n  console.error(`probe-check supports chrome|safari only, got ${candidate}`)\n  process.exit(2)\n}","typeGuard":"const isProbeBrowser = (s: string): s is 'chrome' | 'safari' =>\n  s === 'chrome' || s === 'safari'","tryCatchPattern":null,"preventionTips":["probe-check is chrome/safari only by design; Firefox diagnostics belong to the dedicated checkers.","Mind inherited PROBE_CHECK_BROWSER env vars when the throw names a value you did not pass on the CLI.","Default to chrome (omit --browser) unless you specifically need Safari extraction."],"tags":["cli","browser-automation","config"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}