oven-sh/bun · error · bun_install::Error
SymLinkLoop
Error message
SymLinkLoop
What it means
Sentinel variant of the install (package manager) Error enum mirroring errno ELOOP: resolving or writing a path crossed too many symbolic links (a symlink cycle in node_modules or the cache). Consumers map the variant to user-facing install error messages.
Solutions
- Find and break the circular symlink chain (often caused by bad postinstall scripts or manual linking)
- Clear node_modules and the Bun cache, then reinstall
- Check for accidentally self-referencing symlinks in the project
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
- Let bun own node_modules links
- Never create mutual symlinks between project and node_modules
- Audit workspace globs for cyclic links
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.
Appendix: 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)