{"record":{"id":"3ca781b42f04170e","repo":"astral-sh/ruff","slug":"file-does-not-exist","errorCode":null,"errorMessage":"File does not exist","messagePattern":"File does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/ty_wasm/src/lib.rs","lineNumber":221,"sourceCode":"\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(),\n                kind: ChangedKind::FileMetadata,\n            },\n        ]);\n","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_wasm/src/lib.rs#L203-L239","documentation":"A wasm-bindgen Error from ty's updateFile binding: the target file does not exist on the wasm system's filesystem, so there is nothing to update. The existence check runs before any write is attempted.","triggerScenarios":"Thrown at crates/ty_wasm/src/lib.rs:221 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the file first with the create/open API before updating","Check the file handle is still valid before calling updateFile"],"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-14T05:17:10.506Z"}