astral-sh/ruff · error · Error
Cannot update non-system files (vendored files are read-only
Error message
Cannot update non-system files (vendored files are read-only)
What it means
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.
Source
Thrown at crates/ty_wasm/src/lib.rs:217
.write_file_all(&path, contents)
.map_err(into_error)?;
self.db.apply_changes(&[ChangeEvent::Opened(path.clone())]);
let file = system_path_to_file(&self.db, &path).expect("File to exist");
self.db.project().open_file(&mut self.db, file);
Ok(FileHandle {
path: path.into(),
file,
})
}
#[wasm_bindgen(js_name = "updateFile")]
pub fn update_file(&mut self, file_id: &FileHandle, contents: &str) -> Result<(), Error> {
let system_path = file_id.path.as_system_path().ok_or_else(|| {
Error::new("Cannot update non-system files (vendored files are read-only)")
})?;
if !self.system.fs.exists(system_path) {
return Err(Error::new("File does not exist"));
}
self.system
.fs
.write_file(system_path, contents)
.map_err(into_error)?;
self.db.apply_changes(&[
ChangeEvent::Changed {
path: system_path.to_path_buf(),
kind: ChangedKind::FileContent,
},
ChangeEvent::Changed {
path: system_path.to_path_buf(),View on GitHub (pinned to 26f38c119c)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/ty_wasm/src/lib.rs:217 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/ruff@26f38c119c (2026-09-05).
Data as JSON: /api/errors/8e183d01b412d1d5.
Report an issue: GitHub.