{"record":{"id":"2aab5f89c259d287","repo":"oven-sh/bun","slug":"page-cache-eviction-failed-for-path-results-wo","errorCode":null,"errorMessage":"page-cache eviction failed for ${path}; results would be warm-cache","messagePattern":"page-cache eviction failed for (.+?); results would be warm-cache","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/copyfile/fallback-rw-loop.mjs","lineNumber":32,"sourceCode":"const libc = dlopen(\"libc.so.6\", {\n  posix_fadvise: {\n    args: [FFIType.i32, FFIType.i64, FFIType.i64, FFIType.i32],\n    returns: FFIType.i32,\n  },\n  fdatasync: { args: [FFIType.i32], returns: FFIType.i32 },\n});\nconst POSIX_FADV_DONTNEED = 4;\n\nfunction evict(path) {\n  let fd;\n  try {\n    fd = fs.openSync(path, \"r+\");\n  } catch {\n    return;\n  }\n  try {\n    if (libc.symbols.fdatasync(fd) !== 0 || libc.symbols.posix_fadvise(fd, 0n, 0n, POSIX_FADV_DONTNEED) !== 0) {\n      throw new Error(`page-cache eviction failed for ${path}; results would be warm-cache`);\n    }\n  } finally {\n    fs.closeSync(fd);\n  }\n}\n\nif (!process.env.BUN_CONFIG_DISABLE_COPY_FILE_RANGE) {\n  console.error(\"note: BUN_CONFIG_DISABLE_COPY_FILE_RANGE not set; fast paths will be used\");\n}\n\nfor (const mb of [1, 64, 512]) {\n  const src = join(tmpdir(), `cp-fallback-src-${mb}m.bin`);\n  const dst = join(tmpdir(), `cp-fallback-dst-${mb}m.bin`);\n  try {\n    {\n      const chunk = Buffer.allocUnsafe(1048576);\n      for (let i = 0; i < chunk.length; i++) chunk[i] = i & 0xff;\n      const fd = fs.openSync(src, \"w\");","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/copyfile/fallback-rw-loop.mjs#L14-L50","documentation":"Generic failure raised when the tarball handling pipeline fails without a more specific diagnosis. It is produced by libarchive's ARCHIVE_FAILED/ARCHIVE_FATAL results (mapped via From<bun_libarchive::Error> at src/install/error.rs:411) and by TarballStream when the gzip->tar stream cannot be opened, a header/data block read fails, or archive setup calls return nonzero (src/install/TarballStream.rs:566-637, 960-963).","triggerScenarios":"Running `bun add` / `bun install` where the downloaded body is not a valid gzip-compressed tarball (e.g. an HTML error/login page returned with 200 by a proxy), a truncated/interrupted download, or libarchive failing mid-extraction of a cached tarball.","commonSituations":"Corporate proxies or npm mirrors serving corrupted artifacts; a custom registry misconfigured in bunfig.toml; a partial tarball left in the cache after a killed install; CDN or network middleboxes mangling the response body.","solutions":["Clear the package cache and refetch: `bun pm cache rm && bun install --force`","Manually fetch the tarball URL (shown in the install log / `npm view <pkg> dist.tarball`) with curl and confirm it is valid gzip+tar","Check `[install] registry` in bunfig.toml and npm config; try registry.npmjs.org directly","If only one package fails, pin a different version of it or install the tarball URL explicitly"],"exampleFix":"# before (bunfig.toml)\n[install]\nregistry = \"https://internal-mirror.example.com/\"\n\n# after\n[install]\nregistry = \"https://registry.npmjs.org/\"","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"const res = Bun.spawnSync([\"bun\", \"install\"], { stdout: \"pipe\", stderr: \"pipe\" });\nif (res.exitCode !== 0 && /Fail/.test(res.stderr.toString())) {\n  Bun.spawnSync([\"bun\", \"pm\", \"cache\", \"rm\"]);\n  const retry = Bun.spawnSync([\"bun\", \"install\"], { stdout: \"inherit\", stderr: \"inherit\" });\n  process.exit(retry.exitCode);\n}","preventionTips":["Pin a reliable registry in bunfig.toml instead of unstable mirrors","Keep CI installs on --frozen-lockfile so artifacts are fetched once and pinned","Do not kill `bun install` mid-download; partial cache entries invite stream failures"],"tags":["install","tarball","libarchive","network","cache"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}