cypress-io/cypress · error · Error

Corrupted download Expected downloaded file to have checksu

Error message

Corrupted download

Expected downloaded file to have checksum: ${expectedChecksum}
Computed checksum: ${checksum}

Expected downloaded file to have size: ${expectedSize}
Computed size: ${filesize}

What it means

Raised by verifyDownloadedFile() during Cypress binary installation when the downloaded cypress.zip has BOTH a mismatched checksum and a mismatched file size versus the x-amz-meta-checksum / x-amz-meta-size (or content-length) headers served by the download CDN. It means the bytes on disk are not the bytes the release pipeline published, indicating a truncated, corrupt, or tampered download.

Source

Thrown at cli/lib/tasks/download.ts:143

          debug('downloaded file has the expected checksum and size ✅')

          return
        }

        debug('raising error: checksum or file size mismatch')
        const text = stripIndent`
          Corrupted download

          Expected downloaded file to have checksum: ${expectedChecksum}
          Computed checksum: ${checksum}

          Expected downloaded file to have size: ${expectedSize}
          Computed size: ${filesize}
        `

        debug(text)

        throw new Error(text)
      },
    )
  }

  if (expectedChecksum) {
    debug('only checking expected file checksum %d', expectedChecksum)

    const checksum: string = await util.getFileChecksum(filename)

    if (checksum === expectedChecksum) {
      debug('downloaded file has the expected checksum ✅')

      return
    }

    debug('raising error: file checksum mismatch')
    const text = stripIndent`
      Corrupted download

View on GitHub (pinned to 0d85fdc912)

Solutions

  1. Re-run `cypress install` (or reinstall the cypress npm package) so the binary downloads fresh.
  2. Clear the Cypress cache (rm -rf of the CYPRESS_CACHE_FOLDER, default ~/.cache/Cypress) and the npm cache, then reinstall.
  3. If behind a proxy, verify HTTPS_PROXY/HTTP_PROXY and the proxy's max body size; try a direct connection or a trusted mirror via CYPRESS_DOWNLOAD_MIRROR.
  4. Set CYPRESS_INSTALL_BINARY to a known-good local zip or trusted URL to bypass the CDN path entirely.

Example fix

# before: install fails with checksum+size mismatch
# after:
rm -rf ~/.cache/Cypress
cypress install
Defensive patterns

Strategy: retry

Try / catch

async function installWithRetry(retries = 2) {
  for (let attempt = 0; attempt <= retries; attempt++) {
    try {
      await installBinary()
      return
    } catch (e) {
      if (e instanceof Error && /Corrupted download/.test(e.message) && attempt < retries) {
        await fs.remove(cacheFolder)
        continue
      }
      throw e
    }
  }
}

Prevention

When it happens

Trigger: Running `cypress install` or npm/yarn postinstall where the network drops mid-download but the connection closes cleanly, or a transparent proxy/CDN cache serves a stale or partial artifact. Triggered only when the server response included both x-amz-meta-checksum and a size header.

Common situations: Flaky corporate proxies or VPNs truncating large responses; a corrupted npm cache; a mirror (CYPRESS_DOWNLOAD_MIRROR) serving a wrong/incomplete artifact; disk filling up mid-write; antivirus rewriting the streamed zip.

Related errors


AI-assisted analysis of cypress-io/cypress@0d85fdc912 (2026-08-12). Data as JSON: /api/errors/98d3c504ee0a81b5. Report an issue: GitHub.