{"record":{"id":"68ffa3030efdbdbe","repo":"oven-sh/bun","slug":"nametoolong-68ffa3","errorCode":null,"errorMessage":"NameTooLong","messagePattern":"NameTooLong","errorType":"error_code","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":9,"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\")]","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L1-L27","documentation":"Installer error matching ENAMETOOLONG: a path or path component written during install exceeds the OS limit (255 bytes per component on POSIX, PATH_MAX overall, MAX_PATH on Windows), typically deep inside node_modules, bin links, or the cache layout.","triggerScenarios":"Deeply nested dependency chains with long scoped names; project checked out under a very long absolute path; cache dir configured far down the tree; Windows 260-char MAX_PATH exceeded.","commonSituations":"Monorepos under long user directories (especially on Windows); long generated package names; CI agents with deep workspace paths; nested workspace roots.","solutions":["Move/clone the project closer to the filesystem root to shorten the absolute path","Set BUN_INSTALL_CACHE_DIR to a short path (e.g. /c/bun-cache or C:\\\\bc)","On Windows, enable long paths (LongPathsEnabled registry + git core.longpaths) or shorten the checkout dir","Bump the offending dependency if a transitive chain produces over-long names"],"exampleFix":"# before\n/home/user/very/long/deeply/nested/path/to/repo && bun install\n\n# after\nmv repo ~/r && cd ~/r && bun install","handlingStrategy":"validation","validationCode":"const cwd = process.cwd();\nconst budget = process.platform === \"win32\" ? 240 : 4000;\nif (cwd.length + \"/node_modules/\".length + 255 > budget) {\n  console.error(\"project path too deep; move the checkout closer to the root\");\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep CI checkouts at shallow absolute paths","Shorten the cache dir env on constrained agents","Enable Windows long-path support for deep trees"],"tags":["install","filesystem","paths","enametoolong"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}