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

SymLinkLoop

Error message

SymLinkLoop

What it means

Installer error matching ELOOP: path resolution crossed more symbolic links than the kernel allows (40 on Linux), meaning a symlink cycle in node_modules, workspace links, or the project tree.

Source

Thrown at src/install/error.rs:11

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

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Remove the offending symlink chain (the error context names the path)
  2. Rebuild the tree: rm -rf node_modules && bun install
  3. Audit workspace package globs for cycles
  4. Never create symlinks inside node_modules manually

Example fix

# before
node_modules/foo -> ../foo
foo -> node_modules/foo   # cycle

# after
rm foo
bun install
Defensive patterns

Strategy: validation

Validate before calling

import { realpathSync } from "node:fs";

try {
  realpathSync("node_modules/foo");
} catch (e) {
  if ((e as NodeJS.ErrnoException).code === "ELOOP") {
    console.error("symlink cycle under node_modules/foo");
    process.exit(1);
  }
}

Prevention

When it happens

Trigger: An A->B->A symlink chain inside node_modules (manual symlinks, broken workspace linking); a bin link pointing back into its own directory chain; a project-root symlink that includes itself in its subtree.

Common situations: Hand-made symlinks to share packages between projects; layouts migrated from other package managers; cyclic workspace package links; a symlink pointing at its own ancestor.

Related errors


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