{"record":{"id":"df1e16fb3b60475d","repo":"oven-sh/bun","slug":"symlinkloop","errorCode":null,"errorMessage":"SymLinkLoop","messagePattern":"SymLinkLoop","errorType":"error_code","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":11,"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\")]","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L1-L29","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the offending symlink chain (the error context names the path)","Rebuild the tree: rm -rf node_modules && bun install","Audit workspace package globs for cycles","Never create symlinks inside node_modules manually"],"exampleFix":"# before\nnode_modules/foo -> ../foo\nfoo -> node_modules/foo   # cycle\n\n# after\nrm foo\nbun install","handlingStrategy":"validation","validationCode":"import { realpathSync } from \"node:fs\";\n\ntry {\n  realpathSync(\"node_modules/foo\");\n} catch (e) {\n  if ((e as NodeJS.ErrnoException).code === \"ELOOP\") {\n    console.error(\"symlink cycle under node_modules/foo\");\n    process.exit(1);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Let bun own node_modules links","Never create mutual symlinks between project and node_modules","Audit workspace globs for cyclic links"],"tags":["install","symlink","eloop","filesystem"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}