{"record":{"id":"7f68db4954b28855","repo":"oven-sh/bun","slug":"systemresources","errorCode":null,"errorMessage":"SystemResources","messagePattern":"SystemResources","errorType":"error_code","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":15,"sourceCode":"#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]\npub enum Error {\n    #[error(\"FileNotFound\")]\n    FileNotFound,\n    #[error(\"AccessDenied\")]\n    AccessDenied,\n    #[error(\"NotDir\")]\n    NotDir,\n    #[error(\"NameTooLong\")]\n    NameTooLong,\n    #[error(\"SymLinkLoop\")]\n    SymLinkLoop,\n    #[error(\"SystemFdQuotaExceeded\")]\n    SystemFdQuotaExceeded,\n    #[error(\"SystemResources\")]\n    SystemResources,\n    #[error(\"DeviceBusy\")]\n    DeviceBusy,\n    #[error(\"TarballHTTP400\")]\n    TarballHTTP400,\n    #[error(\"TarballHTTP401\")]\n    TarballHTTP401,\n    #[error(\"TarballHTTP402\")]\n    TarballHTTP402,\n    #[error(\"TarballHTTP403\")]\n    TarballHTTP403,\n    #[error(\"TarballHTTP404\")]\n    TarballHTTP404,\n    #[error(\"TarballHTTP4xx\")]\n    TarballHTTP4xx,\n    #[error(\"TarballHTTP5xx\")]\n    TarballHTTP5xx,\n    #[error(\"TarballFailedToExtract\")]","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L1-L33","documentation":"Installer error for ENOMEM-class failures: the kernel could not allocate resources (memory, kernel structures) needed by the install. It indicates environment pressure rather than a lockfile or code defect, and is often transient.","triggerScenarios":"Container/cgroup memory limits hit while extracting or buffering package data; system under heavy load; allocation failures during subprocess spawn or cache writes.","commonSituations":"Docker/Kubernetes memory limits too small for the dependency tree; oversubscribed CI agents; swap exhausted on the build host.","solutions":["Raise the container/cgroup memory limit or free memory and retry","Close competing memory-heavy processes during install","Retry after load drops — frequently transient","For very large trees, install workspace subsets separately to lower peak usage"],"exampleFix":"# before\ndocker run -m 512m --rm bun install   # -> SystemResources\n\n# after\ndocker run -m 2g --rm bun install","handlingStrategy":"retry","validationCode":"import { freemem } from \"node:os\";\n\nif (freemem() < 512 * 1024 * 1024) {\n  console.error(\"low memory; free some before installing\");\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"for (let attempt = 0; attempt < 3; attempt++) {\n  const p = Bun.spawnSync([\"bun\", \"install\"]);\n  if (p.exitCode === 0) break;\n  if (!p.stderr.toString().includes(\"SystemResources\")) process.exit(p.exitCode ?? 1);\n  await Bun.sleep(5000 * (attempt + 1));\n}","preventionTips":["Size CI containers for peak install memory","Monitor swap during large installs","Stagger installs on shared agents"],"tags":["install","memory","system-resources","transient"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}