{"record":{"id":"7dc46d6a8fc9a221","repo":"biomejs/biome","slug":"path-path-already-exists-in-memory-filesystem","errorCode":null,"errorMessage":"path {path:?} already exists in memory filesystem","messagePattern":"path (.+?) already exists in memory filesystem","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/biome_fs/src/fs/memory.rs","lineNumber":164,"sourceCode":"            // Acquire write access to the files map if the file may need to be created\n            let mut files = self.files.0.write();\n            match files.entry(Utf8PathBuf::from(path)) {\n                Entry::Vacant(entry) => {\n                    // we create an empty file\n                    let file: FileEntry = Arc::new(Mutex::new(vec![]));\n                    let entry = entry.insert(file);\n                    entry.lock_arc()\n                }\n                Entry::Occupied(entry) => {\n                    if options.create {\n                        // If `create` is true, truncate the file\n                        let entry = entry.into_mut();\n                        *entry = Arc::new(Mutex::new(vec![]));\n                        entry.lock_arc()\n                    } else {\n                        // This branch can only be reached if `create_new` was true,\n                        // we should return an error if the file already exists\n                        return Err(io::Error::new(\n                            io::ErrorKind::AlreadyExists,\n                            format!(\"path {path:?} already exists in memory filesystem\"),\n                        ));\n                    }\n                }\n            }\n        } else {\n            let files = self.files.0.read();\n            let entry = files.get(path).ok_or_else(|| {\n                io::Error::new(\n                    io::ErrorKind::NotFound,\n                    format!(\"path {path:?} does not exists in memory filesystem\"),\n                )\n            })?;\n\n            entry.lock_arc()\n        };\n","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/biomejs/biome/blob/405dedb0ff65dd29927faf587f6542e3c29db248/crates/biome_fs/src/fs/memory.rs#L146-L182","documentation":"Error \"path {path:?} already exists in memory filesystem\" thrown in biomejs/biome.","triggerScenarios":"Thrown at crates/biome_fs/src/fs/memory.rs:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the path already exists before opening with `create_new`.","Use `create` instead of `create_new` when truncation of an existing file is acceptable."],"exampleFix":"if fs.path_exists(path) { /* reuse existing file */ } else { fs.open_with_options(path, OpenOptions::default().create_new(true))?; }","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"405dedb0ff65dd29927faf587f6542e3c29db248","analyzedAt":"2026-08-20T00:25:09.682Z","contentChangedAt":"2026-08-20T00:25:09.682Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}