{"record":{"id":"a0899f3e020e9f8b","repo":"biomejs/biome","slug":"cannot-acquire-write-access-to-file-in-read-only-f","errorCode":null,"errorMessage":"cannot acquire write access to file in read-only filesystem","messagePattern":"cannot acquire write access to file in read-only filesystem","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/biome_fs/src/fs/memory.rs","lineNumber":139,"sourceCode":"\n    pub fn set_on_get_staged_files(\n        &mut self,\n        cfn: Box<dyn FnOnce() -> Vec<String> + Send + RefUnwindSafe + 'static>,\n    ) {\n        self.on_get_staged_files = Some(Arc::new(AssertUnwindSafe(Mutex::new(Some(cfn)))));\n    }\n}\n\nimpl FileSystem for MemoryFileSystem {\n    fn open_with_options(\n        &self,\n        path: &Utf8Path,\n        options: OpenOptions,\n    ) -> io::Result<Box<dyn File>> {\n        if !self.allow_write\n            && (options.create || options.create_new || options.truncate || options.write)\n        {\n            return Err(io::Error::new(\n                io::ErrorKind::PermissionDenied,\n                \"cannot acquire write access to file in read-only filesystem\",\n            ));\n        }\n\n        let mut inner = if options.create || options.create_new {\n            // 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","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/biomejs/biome/blob/405dedb0ff65dd29927faf587f6542e3c29db248/crates/biome_fs/src/fs/memory.rs#L121-L157","documentation":"Error \"cannot acquire write access to file in read-only filesystem\" thrown in biomejs/biome.","triggerScenarios":"Thrown at crates/biome_fs/src/fs/memory.rs:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the memory filesystem with `allow_write` enabled before attempting write operations.","Use read-only open options when the filesystem is configured as read-only."],"exampleFix":"let fs = MemoryFileSystem::default(); fs.set_allow_write(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"}