biomejs/biome · error · io::Error
cannot acquire write access to file in read-only filesystem
Error message
cannot acquire write access to file in read-only filesystem
What it means
Error "cannot acquire write access to file in read-only filesystem" thrown in biomejs/biome.
Source
Thrown at crates/biome_fs/src/fs/memory.rs:139
pub fn set_on_get_staged_files(
&mut self,
cfn: Box<dyn FnOnce() -> Vec<String> + Send + RefUnwindSafe + 'static>,
) {
self.on_get_staged_files = Some(Arc::new(AssertUnwindSafe(Mutex::new(Some(cfn)))));
}
}
impl FileSystem for MemoryFileSystem {
fn open_with_options(
&self,
path: &Utf8Path,
options: OpenOptions,
) -> io::Result<Box<dyn File>> {
if !self.allow_write
&& (options.create || options.create_new || options.truncate || options.write)
{
return Err(io::Error::new(
io::ErrorKind::PermissionDenied,
"cannot acquire write access to file in read-only filesystem",
));
}
let mut inner = if options.create || options.create_new {
// 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 fileView on GitHub (pinned to 405dedb0ff)
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.
Example fix
let fs = MemoryFileSystem::default(); fs.set_allow_write(true);
When it happens
Trigger: Thrown at crates/biome_fs/src/fs/memory.rs:139 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/a0899f3e020e9f8b.
Report an issue: GitHub.