biomejs/biome · error · io::Error

this file wasn't open with read access

Error message

this file wasn't open with read access

What it means

Error "this file wasn't open with read access" thrown in biomejs/biome.

Source

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

    fn read_link(&self, _path: &Utf8Path) -> io::Result<Utf8PathBuf> {
        Err(io::Error::new(
            io::ErrorKind::Unsupported,
            "memory FS doesn't support symlinks",
        ))
    }
}

struct MemoryFile {
    inner: ArcMutexGuard<RawMutex, Vec<u8>>,
    can_read: bool,
    can_write: bool,
    version: i32,
}

impl File for MemoryFile {
    fn read_to_string(&mut self, buffer: &mut String) -> io::Result<()> {
        if !self.can_read {
            return Err(io::Error::new(
                io::ErrorKind::PermissionDenied,
                "this file wasn't open with read access",
            ));
        }

        // Verify the stored byte content is valid UTF-8
        let content = str::from_utf8(&self.inner)
            .map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
        // Append the content of the file to the buffer
        buffer.push_str(content);
        Ok(())
    }

    fn set_content(&mut self, content: &[u8]) -> io::Result<()> {
        if !self.can_write {
            return Err(io::Error::new(
                io::ErrorKind::PermissionDenied,
                "this file wasn't open with write access",

View on GitHub (pinned to 405dedb0ff)

Solutions

  1. Open the file with read access (`OpenOptions::read(true)`) before calling `read_to_string`.

Example fix

let mut file = fs.open_with_options(path, OpenOptions::default().read(true))?; file.read_to_string(&mut buf)?;

When it happens

Trigger: Thrown at crates/biome_fs/src/fs/memory.rs:266 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/b6c40a7385435921. Report an issue: GitHub.