oven-sh/bun · error · bun_install::Error
SystemResources
Error message
SystemResources
What it means
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.
Source
Thrown at src/install/error.rs:15
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
pub enum Error {
#[error("FileNotFound")]
FileNotFound,
#[error("AccessDenied")]
AccessDenied,
#[error("NotDir")]
NotDir,
#[error("NameTooLong")]
NameTooLong,
#[error("SymLinkLoop")]
SymLinkLoop,
#[error("SystemFdQuotaExceeded")]
SystemFdQuotaExceeded,
#[error("SystemResources")]
SystemResources,
#[error("DeviceBusy")]
DeviceBusy,
#[error("TarballHTTP400")]
TarballHTTP400,
#[error("TarballHTTP401")]
TarballHTTP401,
#[error("TarballHTTP402")]
TarballHTTP402,
#[error("TarballHTTP403")]
TarballHTTP403,
#[error("TarballHTTP404")]
TarballHTTP404,
#[error("TarballHTTP4xx")]
TarballHTTP4xx,
#[error("TarballHTTP5xx")]
TarballHTTP5xx,
#[error("TarballFailedToExtract")]View on GitHub (pinned to 8c5296ac45)
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
Example fix
# before docker run -m 512m --rm bun install # -> SystemResources # after docker run -m 2g --rm bun install
Defensive patterns
Strategy: retry
Validate before calling
import { freemem } from "node:os";
if (freemem() < 512 * 1024 * 1024) {
console.error("low memory; free some before installing");
process.exit(1);
} Try / catch
for (let attempt = 0; attempt < 3; attempt++) {
const p = Bun.spawnSync(["bun", "install"]);
if (p.exitCode === 0) break;
if (!p.stderr.toString().includes("SystemResources")) process.exit(p.exitCode ?? 1);
await Bun.sleep(5000 * (attempt + 1));
} Prevention
- Size CI containers for peak install memory
- Monitor swap during large installs
- Stagger installs on shared agents
When it happens
Trigger: Container/cgroup memory limits hit while extracting or buffering package data; system under heavy load; allocation failures during subprocess spawn or cache writes.
Common situations: Docker/Kubernetes memory limits too small for the dependency tree; oversubscribed CI agents; swap exhausted on the build host.
Related errors
- page-cache eviction failed for ${path}; results would be war
- size mismatch
- not called
- not 200
- not implemented right
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/7f68db4954b28855.
Report an issue: GitHub.