oven-sh/bun · error · bun_install::Error

SystemFdQuotaExceeded

Error message

SystemFdQuotaExceeded

What it means

Installer error for fd exhaustion (the EMFILE family). Notably, libarchive's MakeLibUvOwned failure is mapped to this exact variant (see From<bun_libarchive::Error> in error.rs), so tarball extraction that cannot acquire descriptors also surfaces here. It means the process hit its open-file limit, not that disk or memory is exhausted.

Source

Thrown at src/install/error.rs:13

#[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")]

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Raise the limit for the session before installing: ulimit -n 4096 (macOS persistent: sudo launchctl limit maxfiles)
  2. Close fd-heavy processes (watchers, editors) during large installs
  3. Configure the CI runner/container with a higher nofile limit (docker --ulimit nofile=8192)
  4. Retry after freeing descriptors; bun resumes from partial install state

Example fix

# before
bun install   # -> SystemFdQuotaExceeded

# after
ulimit -n 4096
bun install
Defensive patterns

Strategy: validation

Validate before calling

# fail fast if the fd soft limit is too low for a big install
SOFT=$(ulimit -Sn)
[ "$SOFT" -lt 2048 ] && { echo "raise fd limit: ulimit -n 2048"; exit 1; }
bun install

Prevention

When it happens

Trigger: Large installs extracting many tarballs concurrently under a low `ulimit -n`; watchers/dev servers consuming the user's fd budget; extraction of huge dependency trees in constrained CI containers.

Common situations: macOS default 256 fd soft limit; containers with low RLIMIT_NOFILE; long-lived machines with many open editors/watchers during big installs.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/a6c771970558785b. Report an issue: GitHub.