biomejs/biome · error · io::Error

path {path:?} already exists in memory filesystem

Error message

path {path:?} already exists in memory filesystem

What it means

Error "path {path:?} already exists in memory filesystem" thrown in biomejs/biome.

Source

Thrown at crates/biome_fs/src/fs/memory.rs:164

            // Acquire write access to the files map if the file may need to be created
            let mut files = self.files.0.write();
            match files.entry(Utf8PathBuf::from(path)) {
                Entry::Vacant(entry) => {
                    // we create an empty file
                    let file: FileEntry = Arc::new(Mutex::new(vec![]));
                    let entry = entry.insert(file);
                    entry.lock_arc()
                }
                Entry::Occupied(entry) => {
                    if options.create {
                        // If `create` is true, truncate the file
                        let entry = entry.into_mut();
                        *entry = Arc::new(Mutex::new(vec![]));
                        entry.lock_arc()
                    } else {
                        // This branch can only be reached if `create_new` was true,
                        // we should return an error if the file already exists
                        return Err(io::Error::new(
                            io::ErrorKind::AlreadyExists,
                            format!("path {path:?} already exists in memory filesystem"),
                        ));
                    }
                }
            }
        } else {
            let files = self.files.0.read();
            let entry = files.get(path).ok_or_else(|| {
                io::Error::new(
                    io::ErrorKind::NotFound,
                    format!("path {path:?} does not exists in memory filesystem"),
                )
            })?;

            entry.lock_arc()
        };

View on GitHub (pinned to 405dedb0ff)

Solutions

  1. Check whether the path already exists before opening with `create_new`.
  2. Use `create` instead of `create_new` when truncation of an existing file is acceptable.

Example fix

if fs.path_exists(path) { /* reuse existing file */ } else { fs.open_with_options(path, OpenOptions::default().create_new(true))?; }

When it happens

Trigger: Thrown at crates/biome_fs/src/fs/memory.rs:164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of biomejs/biome@405dedb0ff (2026-08-20). Data as JSON: /api/errors/7dc46d6a8fc9a221. Report an issue: GitHub.