{"record":{"id":"8e183d01b412d1d5","repo":"astral-sh/ruff","slug":"cannot-update-non-system-files-vendored-files-are","errorCode":null,"errorMessage":"Cannot update non-system files (vendored files are read-only)","messagePattern":"Cannot update non-system files \\(vendored files are read-only\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/ty_wasm/src/lib.rs","lineNumber":217,"sourceCode":"            .write_file_all(&path, contents)\n            .map_err(into_error)?;\n\n        self.db.apply_changes(&[ChangeEvent::Opened(path.clone())]);\n\n        let file = system_path_to_file(&self.db, &path).expect(\"File to exist\");\n\n        self.db.project().open_file(&mut self.db, file);\n\n        Ok(FileHandle {\n            path: path.into(),\n            file,\n        })\n    }\n\n    #[wasm_bindgen(js_name = \"updateFile\")]\n    pub fn update_file(&mut self, file_id: &FileHandle, contents: &str) -> Result<(), Error> {\n        let system_path = file_id.path.as_system_path().ok_or_else(|| {\n            Error::new(\"Cannot update non-system files (vendored files are read-only)\")\n        })?;\n\n        if !self.system.fs.exists(system_path) {\n            return Err(Error::new(\"File does not exist\"));\n        }\n\n        self.system\n            .fs\n            .write_file(system_path, contents)\n            .map_err(into_error)?;\n\n        self.db.apply_changes(&[\n            ChangeEvent::Changed {\n                path: system_path.to_path_buf(),\n                kind: ChangedKind::FileContent,\n            },\n            ChangeEvent::Changed {\n                path: system_path.to_path_buf(),","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_wasm/src/lib.rs#L199-L235","documentation":"A wasm-bindgen Error from ty's updateFile binding: the file handle's path is not a system path (for example a vendored path). Vendored and other non-system files are read-only in the wasm playground, so their contents cannot be updated.","triggerScenarios":"Thrown at crates/ty_wasm/src/lib.rs:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only call updateFile on files created via the system API","Re-create the file as a system file instead of updating a vendored one"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}