{"record":{"id":"99cc4682404fdbc5","repo":"microsoft/playwright","slug":"failed-to-launch-this-name-because-executable","errorCode":null,"errorMessage":"Failed to launch ${this._name} because executable doesn't exist at ${executablePath}","messagePattern":"Failed to launch (.+?) because executable doesn't exist at (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/browserType.ts","lineNumber":351,"sourceCode":"  }\n\n  async prepareUserDataDir(options: types.LaunchOptions, userDataDir: string): Promise<void> {\n  }\n\n  supportsPipeTransport(options: types.LaunchOptions): boolean {\n    return true;\n  }\n\n  getExecutableName(options: types.LaunchOptions): string {\n    return options.channel || this._name;\n  }\n\n  protected async resolveExecutablePath(options: types.LaunchOptions): Promise<string | undefined> {\n    const { executablePath } = options;\n    if (!executablePath)\n      return undefined;\n    if (!(await existsAsync(executablePath)))\n      throw new Error(`Failed to launch ${this._name} because executable doesn't exist at ${executablePath}`);\n    return executablePath;\n  }\n\n  abstract defaultArgs(options: types.LaunchOptions, isPersistent: boolean, userDataDir: string): Promise<string[]>;\n  abstract connectToTransport(transport: ConnectionTransport, options: BrowserOptions, browserLogsCollector: RecentLogsCollector): Promise<Browser>;\n  abstract amendEnvironment(env: NodeJS.ProcessEnv, userDataDir: string, isPersistent: boolean, options: types.LaunchOptions): NodeJS.ProcessEnv;\n  abstract doRewriteStartupLog(logs: string): string;\n  abstract attemptToGracefullyCloseBrowser(transport: ConnectionTransport): void;\n}\n\nfunction copyTestHooks(from: object, to: object) {\n  for (const [key, value] of Object.entries(from)) {\n    if (key.startsWith('__testHook'))\n      (to as any)[key] = value;\n  }\n}\n","sourceCodeStart":333,"sourceCodeEnd":368,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/browserType.ts#L333-L368","documentation":"Thrown by resolveExecutablePath when options.executablePath is set (truthy) but existsAsync reports the path does not exist on disk. Playwright checks the custom path before falling back to the registry so a wrong explicit path fails fast rather than producing a confusing spawn error.","triggerScenarios":"chromium.launch({ executablePath: '/wrong/path/chrome' }) where the file is absent. Relative path that resolves against an unexpected cwd.","commonSituations":"Hardcoded path from another machine/container. Typo. Path computed from an env var that is unset. Cross-platform path separators. ARCH mismatch where the path exists for another OS.","solutions":["Verify the path with fs.existsSync before launching; print the absolute path you are passing.","Point executablePath at the real binary, or remove it to let Playwright use the installed/registry browser.","If the binary lives elsewhere per environment, resolve it from a validated env var with a fallback to the registry."],"exampleFix":"// before\nconst b = await chromium.launch({ executablePath: process.env.BROWSER_BIN });\n// after\nconst p = process.env.BROWSER_BIN;\nif (p && !fs.existsSync(p)) throw new Error(`BROWSER_BIN not found: ${p}`);\nconst b = await chromium.launch({ executablePath: p });","handlingStrategy":"validation","validationCode":"import fs from 'fs';\nfunction resolveExecutable(p?: string): string | undefined {\n  if (!p) return undefined;\n  if (!fs.existsSync(p)) throw new Error(`executablePath does not exist: ${p}`);\n  return p;\n}\n// chromium.launch({ executablePath: resolveExecutable(process.env.BROWSER_BIN) })","typeGuard":"function executableExists(p?: string): boolean {\n  return !p || fs.existsSync(p);\n}","tryCatchPattern":null,"preventionTips":["Always fs.existsSync-check an explicit executablePath before launch.","Prefer letting Playwright resolve the registry binary by omitting executablePath."],"tags":["launch","executable-path","validation","browser-binary"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}