{"record":{"id":"67003ff3e045b74c","repo":"can1357/oh-my-pi","slug":"unsupported-browser-download-browser","errorCode":null,"errorMessage":"Unsupported browser download: ${browser}","messagePattern":"Unsupported browser download: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/utils/src/browsers.ts","lineNumber":158,"sourceCode":"\tif (/^\\d+$/.test(tag)) {\n\t\tconst metadata = await fetchMetadata<MilestoneVersions>(\"latest-versions-per-milestone.json\");\n\t\treturn metadata.milestones[tag]?.version ?? tag;\n\t}\n\tif (/^\\d+\\.\\d+\\.\\d+$/.test(tag)) {\n\t\tconst metadata = await fetchMetadata<PatchVersions>(\"latest-patch-versions-per-build.json\");\n\t\treturn metadata.builds[tag]?.version ?? tag;\n\t}\n\treturn tag;\n}\n\n/** Return the Chrome-for-Testing archive URL for a browser build. */\nexport function getDownloadUrl(\n\tbrowser: Browser,\n\tplatform: BrowserPlatform,\n\tbuildId: string,\n\tbaseUrl = CHROME_FOR_TESTING_BASE_URL,\n): URL {\n\tif (browser !== Browser.CHROME) throw new Error(`Unsupported browser download: ${browser}`);\n\tconst archivePlatform = chromeArchivePlatform(platform);\n\tconst root = baseUrl.replace(/\\/$/, \"\");\n\treturn new URL(`${root}/${buildId}/${archivePlatform}/chrome-${archivePlatform}.zip`);\n}\n\n/** Compute the executable path in Puppeteer's cache layout. */\nexport function computeExecutablePath(options: ComputeExecutablePathOptions): string {\n\tconst platform = options.platform ?? detectBrowserPlatform();\n\tif (!platform) throw new Error(\"Cannot determine a browser platform for this host\");\n\tif (options.browser !== Browser.CHROME) throw new Error(`Unsupported browser executable: ${options.browser}`);\n\tconst installDir = installationDir(options.cacheDir, options.browser, platform, options.buildId);\n\tswitch (platform) {\n\t\tcase BrowserPlatform.LINUX:\n\t\tcase BrowserPlatform.LINUX_ARM:\n\t\t\treturn path.join(installDir, \"chrome-linux64\", \"chrome\");\n\t\tcase BrowserPlatform.MAC:\n\t\t\treturn path.join(\n\t\t\t\tinstallDir,","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/browsers.ts#L140-L176","documentation":"getDownloadUrl only supports the Chrome product; any other Browser enum value (firefox, chromium, chrome-headless-shell, chromedriver) throws this Error because the Chrome-for-Testing archive URL layout is only valid for Chrome. It is an explicit capability guard in this Puppeteer-compatible shim.","triggerScenarios":"Calling getDownloadUrl(Browser.FIREFOX | Browser.CHROMIUM | Browser.CHROMEHEADLESSSHELL | Browser.CHROMEDRIVER, platform, buildId) — directly or indirectly via install() with a non-Chrome browser.","commonSituations":"Configuring install({ browser: Browser.FIREFOX, ... }) assuming all Puppeteer products are supported; switching an app from chrome to chromium without checking support.","solutions":["Use Browser.CHROME for downloads through this module.","For other products (chromium, firefox, chromedriver), use @puppeteer/browsers directly or a dedicated installer.","Gate user/config-supplied browser values: validate the enum equals Browser.CHROME before calling install()."],"exampleFix":"// before\nawait install({ browser: Browser.FIREFOX, buildId, cacheDir }); // throws\n// after\nif (browser !== Browser.CHROME) {\n  throw new Error(`This installer only manages ${Browser.CHROME}; got ${browser}`);\n}\nawait install({ browser: Browser.CHROME, buildId, cacheDir });","handlingStrategy":"validation","validationCode":"import { Browser } from './browsers';\nif (browser !== Browser.CHROME) {\n  throw new Error(`Only ${Browser.CHROME} is supported by this installer (got ${browser})`);\n}","typeGuard":"function isSupportedForDownload(browser: Browser): browser is Browser.CHROME {\n  return browser === Browser.CHROME;\n}","tryCatchPattern":"try {\n  const url = getDownloadUrl(browser, platform, buildId);\n} catch (err) {\n  if (/^Unsupported browser download: /.test(String(err))) {\n    // route to @puppeteer/browsers or a product-specific installer\n  } else throw err;\n}","preventionTips":["Whitelist Browser.CHROME in any config surface that feeds install().","Use @puppeteer/browsers for chromium/firefox/chromedriver/headless-shell.","Add an enum-narrowing check at your install entry point."],"tags":["browser-download","unsupported-browser","chrome-for-testing"],"backgroundTag":"unsupported-browser-product","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}