oven-sh/bun · error

Tried to delete root and stopped it

Error message

Tried to delete root and stopped it

What it means

Tarball extraction attempted to delete the filesystem root (a tarball entry resolved to `/` or the install root), and Bun's safety guard stopped it. It fires during path validation when a destructive operation targets the root directory.

Solutions

  1. Do not install the malicious/broken tarball; report the package to the registry
  2. Verify the dependency URL/tarball wasn't tampered with
  3. Update Bun — path traversal guards are continuously hardened
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/install/extract_tarball.rs:514 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/install/extract_tarball.rs:514

                    directories::cached_github_folder_name_print(
                        &mut bufs.folder_name_buf,
                        resolved,
                        None,
                    )
                    .as_bytes()
                }
                ResolutionTag::LocalTarball | ResolutionTag::RemoteTarball => {
                    directories::cached_tarball_folder_name_print(
                        &mut bufs.folder_name_buf,
                        self.url.slice(),
                        None,
                    )
                    .as_bytes()
                }
                _ => unreachable!(),
            };
            if folder_name.is_empty() || (folder_name.len() == 1 && folder_name[0] == b'/') {
                panic!("Tried to delete root and stopped it");
            }
            let cache_dir = Dir::borrow(&self.cache_dir);

            // e.g. @next
            // if it's a namespace package, we need to make sure the @name folder exists
            let create_subdir = basename.len() != name.len() && !self.resolution.tag.is_git();

            // Now that we've extracted the archive, we rename.
            #[cfg(windows)]
            {
                // Windows EBUSY/SHARING_VIOLATION on `NtSetInformationFile` is
                // transient when a concurrent process (another `bun install`
                // sharing the cache, AV, the Search Indexer) is closing its
                // handle to the destination. Back off briefly between retries.
                const MAX_RETRIES: u32 = 4;
                let mut retries: u32 = 0;
                let mut path2_buf = WPathBuffer::uninit();
                let path2 = strings::to_wpath_normalized(&mut path2_buf, folder_name);

View on GitHub (pinned to 8c5296ac45)