{"record":{"id":"7b94c79daaad2ae9","repo":"puppeteer/puppeteer","slug":"could-not-resolve-the-current-platform","errorCode":null,"errorMessage":"Could not resolve the current platform","messagePattern":"Could not resolve the current platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/browsers/src/CLI.ts","lineNumber":626,"sourceCode":"  }\n\n  #resolvePinnedBrowserIfNeeded(buildId: string, browserName: Browser): string {\n    if (buildId === 'pinned') {\n      const options = this.#pinnedBrowsers?.[browserName];\n      if (!options || !options.buildId) {\n        throw new Error(`No pinned version found for ${browserName}`);\n      }\n      return options.buildId;\n    }\n    return buildId;\n  }\n\n  async #install(args: InstallArgs) {\n    if (!args.browser) {\n      throw new Error(`No browser arg provided`);\n    }\n    if (!args.platform) {\n      throw new Error(`Could not resolve the current platform`);\n    }\n    args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(\n      args.browser.buildId,\n      args.browser.name,\n    );\n    const originalBuildId = args.browser.buildId;\n    args.browser.buildId = await resolveBuildId(\n      args.browser.name,\n      args.platform,\n      args.browser.buildId,\n    );\n    await install({\n      browser: args.browser.name,\n      buildId: args.browser.buildId,\n      platform: args.platform,\n      cacheDir: args.path ?? this.#cachePath,\n      downloadProgressCallback: 'default',\n      baseUrl: args.baseUrl,","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/puppeteer/puppeteer/blob/d484e21c17f6023826fefdcdeeb553e04a7aaed8/packages/browsers/src/CLI.ts#L608-L644","documentation":"Thrown by `#install` when `args.platform` is falsy after yargs parsing. The platform option defaults to `detectBrowserPlatform()`, which returns `undefined` on operating systems Node does not map to darwin/linux/win32. This is the install-command counterpart to the platform detection failure.","triggerScenarios":"Running `install` on an OS where `detectBrowserPlatform()` returns `undefined` and no explicit `--platform` is supplied.","commonSituations":"Exotic or unsupported host OS in CI (e.g. a FreeBSD jail), a misreported `os.platform()`, or a stripped-down container environment.","solutions":["Pass `--platform <value>` explicitly with one of: linux, linux_arm, mac, mac_arm, win32, win64.","Run on a supported OS image (Linux/macOS/Windows).","Confirm detection with `node -e \"const d=require('@puppeteer/browsers/detectPlatform'); console.log(d.detectBrowserPlatform())\"`."],"exampleFix":"// before\nnpx @puppeteer/browsers install chrome\n// after (on an undetected host)\nnpx @puppeteer/browsers install chrome --platform linux","handlingStrategy":"validation","validationCode":"import { detectBrowserPlatform, BrowserPlatform } from '@puppeteer/browsers';\nconst platform = detectBrowserPlatform();\nif (!platform) {\n  throw new Error(`Auto-detection failed on ${process.platform}; pass --platform <value>`);\n}","typeGuard":"import { BrowserPlatform } from '@puppeteer/browsers';\nfunction isSupportedPlatform(): boolean {\n  return detectBrowserPlatform() !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Pin --platform in CI scripts to avoid relying on detection.","Run on a supported OS image (linux/macOS/windows).","Check detectBrowserPlatform() at startup and fail fast with a helpful message."],"tags":["cli","install","platform","os-detection"],"backgroundTag":null,"analyzedSha":"d484e21c17f6023826fefdcdeeb553e04a7aaed8","analyzedAt":"2026-08-12T06:33:19.665Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}