{"record":{"id":"b6c40a7385435921","repo":"biomejs/biome","slug":"this-file-wasn-t-open-with-read-access","errorCode":null,"errorMessage":"this file wasn't open with read access","messagePattern":"this file wasn't open with read access","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/biome_fs/src/fs/memory.rs","lineNumber":266,"sourceCode":"    fn read_link(&self, _path: &Utf8Path) -> io::Result<Utf8PathBuf> {\n        Err(io::Error::new(\n            io::ErrorKind::Unsupported,\n            \"memory FS doesn't support symlinks\",\n        ))\n    }\n}\n\nstruct MemoryFile {\n    inner: ArcMutexGuard<RawMutex, Vec<u8>>,\n    can_read: bool,\n    can_write: bool,\n    version: i32,\n}\n\nimpl File for MemoryFile {\n    fn read_to_string(&mut self, buffer: &mut String) -> io::Result<()> {\n        if !self.can_read {\n            return Err(io::Error::new(\n                io::ErrorKind::PermissionDenied,\n                \"this file wasn't open with read access\",\n            ));\n        }\n\n        // Verify the stored byte content is valid UTF-8\n        let content = str::from_utf8(&self.inner)\n            .map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;\n        // Append the content of the file to the buffer\n        buffer.push_str(content);\n        Ok(())\n    }\n\n    fn set_content(&mut self, content: &[u8]) -> io::Result<()> {\n        if !self.can_write {\n            return Err(io::Error::new(\n                io::ErrorKind::PermissionDenied,\n                \"this file wasn't open with write access\",","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/biomejs/biome/blob/405dedb0ff65dd29927faf587f6542e3c29db248/crates/biome_fs/src/fs/memory.rs#L248-L284","documentation":"Error \"this file wasn't open with read access\" thrown in biomejs/biome.","triggerScenarios":"Thrown at crates/biome_fs/src/fs/memory.rs:266 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the file with read access (`OpenOptions::read(true)`) before calling `read_to_string`."],"exampleFix":"let mut file = fs.open_with_options(path, OpenOptions::default().read(true))?; file.read_to_string(&mut buf)?;","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"}