{"record":{"id":"f86eb9e346a980ce","repo":"microsoft/playwright","slug":"failed-to-install-webkit-via-wsl","errorCode":null,"errorMessage":"Failed to install WebKit via WSL","messagePattern":"Failed to install WebKit via WSL","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/registry/index.ts","lineNumber":758,"sourceCode":"      },\n      // WebKit is installed inside the WSL distribution by install_webkit_wsl.ps1.\n      wslExecutablePath: `/home/pwuser/.cache/ms-playwright/webkit-${webkit.revision}/pw_run.sh`,\n      installType: 'download-on-demand',\n      title: 'Webkit in WSL',\n      _validateHostRequirements: (sdkLanguage: string) => Promise.resolve(),\n      _isHermeticInstallation: true,\n      _install: async () => {\n        if (process.platform !== 'win32')\n          throw new Error(`WebKit via WSL is only supported on Windows`);\n        const script = path.join(BIN_PATH, 'install_webkit_wsl.ps1');\n        const { code } = await spawnAsync('powershell.exe', [\n          '-ExecutionPolicy', 'Bypass',\n          '-File', script,\n        ], {\n          stdio: 'inherit',\n        });\n        if (code !== 0)\n          throw new Error(`Failed to install WebKit via WSL`);\n      },\n    });\n\n    const ffmpeg = descriptors.find(d => d.name === 'ffmpeg')!;\n    const ffmpegExecutable = findExecutablePath(ffmpeg.dir, 'ffmpeg');\n    this._executables.push({\n      name: 'ffmpeg',\n      browserName: undefined,\n      directory: ffmpeg.dir,\n      executablePath: () => ffmpegExecutable,\n      executablePathOrDie: (sdkLanguage: string) => executablePathOrDie('ffmpeg', ffmpegExecutable, ffmpeg.installByDefault, sdkLanguage),\n      installType: ffmpeg.installByDefault ? 'download-by-default' : 'download-on-demand',\n      _validateHostRequirements: () => Promise.resolve(),\n      downloadURLs: this._downloadURLs(ffmpeg),\n      title: ffmpeg.title,\n      revision: ffmpeg.revision,\n      _install: force => this._downloadExecutable(ffmpeg, force, ffmpegExecutable),\n      _dependencyGroup: 'tools',","sourceCodeStart":740,"sourceCodeEnd":776,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/registry/index.ts#L740-L776","documentation":"Thrown by the webkit-wsl _install routine when install_webkit_wsl.ps1, executed via powershell.exe, exits with a non-zero code. The PowerShell script is responsible for installing WebKit inside the WSL distribution; a failure means the WSL-side setup did not complete.","triggerScenarios":"WSL is not installed or no default distribution is set; the powershell script lacks privileges; the WSL distribution cannot download the webkit revision (network/proxy); the pwuser home/cache path is unwritable; WSL itself is broken or partially installed.","commonSituations":"Windows CI without WSL pre-installed; corporate proxy blocking downloads inside WSL; WSL2 not enabled at the OS feature level; a corrupted WSL distribution.","solutions":["Ensure WSL is installed and a default distribution is set (wsl --install, then wsl --set-default), and reboot if WSL was just enabled.","Re-run the install from an elevated PowerShell session and capture the script's own output to see the underlying failure.","Check network/proxy connectivity from inside WSL, and that the pwuser cache directory is writable; if WSL is unusable, fall back to running webkit on a Linux runner."],"exampleFix":"# elevate, ensure WSL is healthy\nwsl --install\nwsl --set-default Ubuntu\n# then re-run\nnpx playwright install webkit-wsl","handlingStrategy":"try-catch","validationCode":"import { execSync } from 'node:child_process';\ntry { execSync('wsl --status', { stdio: 'pipe' }); }\ncatch { throw new Error('WSL not ready; run wsl --install and reboot'); }","typeGuard":null,"tryCatchPattern":"try {\n  await installWebKitWsl();\n} catch (e) {\n  if (/Failed to install WebKit via WSL/.test(e.message)) {\n    // verify WSL is installed/defaulted, re-run elevated, check proxy in WSL, then retry once\n  } else throw e;\n}","preventionTips":["Pre-install and default a WSL distribution before installing webkit-wsl.","Run the installer elevated and capture its output for diagnosis.","Ensure network/proxy works inside WSL and the pwuser cache is writable."],"tags":["registry","webkit","wsl","install","powershell","system"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}