Playwright "Download failed: size mismatch" browser binary in CI
During playwright install, the CDN download for a browser was interrupted or a corporate proxy returned content of the wrong size, so the integrity check fails. This is a transient network or proxy problem, not a Playwright bug.
What this error means
Install fails with "Failed to download Chromium ..." and "Download failed: size mismatch, file size: X, expected size: Y", sometimes after several retry attempts.
Downloading Chromium 130.0.6723.31 (playwright build v1140)
Error: Failed to download Chromium 130.0.6723.31, caused by
Error: Download failed: size mismatch, file size: 1048576, expected size: 168234567.
Download was interrupted, please try again.Common causes
A flaky or rate-limited connection to the CDN
The browser archive is large; a dropped connection mid-transfer leaves a truncated file whose size does not match the manifest.
A proxy that rewrites or truncates binary responses
A TLS-inspecting or caching proxy can return partial content or HTML error pages in place of the binary, failing the size check.
How to fix it
Point the download host through your proxy and retry
Set the proxy and, if needed, an internal mirror via PLAYWRIGHT_DOWNLOAD_HOST so the binary comes from a reliable source.
export HTTPS_PROXY=http://proxy.internal:8080
export PLAYWRIGHT_DOWNLOAD_HOST=https://mirror.internal/playwright
npx playwright install --with-depsCache the browsers so downloads are rare
Persist the ms-playwright cache between runs so a single good download is reused instead of re-fetched each time.
- uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: pw-${{ hashFiles('package-lock.json') }}How to prevent it
- Cache browser binaries to avoid repeated large downloads.
- Mirror Playwright browsers internally when behind a strict proxy.
- Retry install on transient network errors before failing the job.