{"record":{"id":"06361e61852a588c","repo":"oven-sh/bun","slug":"devicebusy","errorCode":null,"errorMessage":"DeviceBusy","messagePattern":"DeviceBusy","errorType":"error_code","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":17,"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\")]\n    TarballHTTP4xx,\n    #[error(\"TarballHTTP5xx\")]\n    TarballHTTP5xx,\n    #[error(\"TarballFailedToExtract\")]\n    TarballFailedToExtract,\n    #[error(\"TarballFailedToDownload\")]","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L1-L35","documentation":"Installer error for EBUSY: a file or resource bun needs is held by another process. On Windows this is the classic file-lock collision during extraction/linking; on Linux it maps to mounts or devices in use.","triggerScenarios":"A dev server, file watcher, editor indexer, or antivirus holds files inside node_modules while bun rewrites them; Windows locks bin shims or native addon files during rename/link; two installs racing on one project.","commonSituations":"Running bun install while a hot-reload dev server serves from the same tree; OneDrive/Dropbox/Defender scanning node_modules in real time; parallel CI jobs sharing a workspace.","solutions":["Stop the process holding the files (dev server, watcher) and rerun bun install","Exclude node_modules from antivirus real-time scans and sync clients","Ensure only one install runs at a time per project","Retry after a short delay once the lock is released"],"exampleFix":"# before (two terminals)\nbun run dev    # watcher holds node_modules\nbun install    # -> DeviceBusy\n\n# after\n# stop the dev server first, then\nbun install && bun run dev","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function installWithRetry() {\n  for (let i = 0; i < 3; i++) {\n    const p = Bun.spawnSync([\"bun\", \"install\"]);\n    if (p.exitCode === 0) return;\n    if (!p.stderr.toString().includes(\"DeviceBusy\")) process.exit(p.exitCode ?? 1);\n    await Bun.sleep(2000); // lock holder often releases within seconds\n  }\n}","preventionTips":["Sequence install before starting watchers","Exclude node_modules from AV and sync clients","Serialize installs in monorepo scripts"],"tags":["install","windows","file-lock","ebusy"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}