{"record":{"id":"98d3c504ee0a81b5","repo":"cypress-io/cypress","slug":"corrupted-download-expected-downloaded-file-to-ha","errorCode":null,"errorMessage":"Corrupted download\n\nExpected downloaded file to have checksum: ${expectedChecksum}\nComputed checksum: ${checksum}\n\nExpected downloaded file to have size: ${expectedSize}\nComputed size: ${filesize}","messagePattern":"Corrupted download\n\nExpected downloaded file to have checksum: (.+?)\nComputed checksum: (.+?)\n\nExpected downloaded file to have size: (.+?)\nComputed size: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/lib/tasks/download.ts","lineNumber":143,"sourceCode":"          debug('downloaded file has the expected checksum and size ✅')\n\n          return\n        }\n\n        debug('raising error: checksum or file size mismatch')\n        const text = stripIndent`\n          Corrupted download\n\n          Expected downloaded file to have checksum: ${expectedChecksum}\n          Computed checksum: ${checksum}\n\n          Expected downloaded file to have size: ${expectedSize}\n          Computed size: ${filesize}\n        `\n\n        debug(text)\n\n        throw new Error(text)\n      },\n    )\n  }\n\n  if (expectedChecksum) {\n    debug('only checking expected file checksum %d', expectedChecksum)\n\n    const checksum: string = await util.getFileChecksum(filename)\n\n    if (checksum === expectedChecksum) {\n      debug('downloaded file has the expected checksum ✅')\n\n      return\n    }\n\n    debug('raising error: file checksum mismatch')\n    const text = stripIndent`\n      Corrupted download","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/cli/lib/tasks/download.ts#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run `cypress install` (or reinstall the cypress npm package) so the binary downloads fresh.","Clear the Cypress cache (rm -rf of the CYPRESS_CACHE_FOLDER, default ~/.cache/Cypress) and the npm cache, then reinstall.","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.","Set CYPRESS_INSTALL_BINARY to a known-good local zip or trusted URL to bypass the CDN path entirely."],"exampleFix":"# before: install fails with checksum+size mismatch\n# after:\nrm -rf ~/.cache/Cypress\ncypress install","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function installWithRetry(retries = 2) {\n  for (let attempt = 0; attempt <= retries; attempt++) {\n    try {\n      await installBinary()\n      return\n    } catch (e) {\n      if (e instanceof Error && /Corrupted download/.test(e.message) && attempt < retries) {\n        await fs.remove(cacheFolder)\n        continue\n      }\n      throw e\n    }\n  }\n}","preventionTips":["Pin a known-good binary via CYPRESS_INSTALL_BINARY in environments with flaky networks.","Keep CYPRESS_CACHE_FOLDER on stable storage with enough free space.","Avoid mirrors you do not control for the binary download."],"tags":["install","download","checksum","network"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}