{"record":{"id":"a9c489d45bfd70f8","repo":"BoundaryML/baml","slug":"failed-to-update-runtime-e","errorCode":null,"errorMessage":"Failed to update runtime: {e}","messagePattern":"Failed to update runtime: (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"engine/language_server/src/baml_project/mod.rs","lineNumber":1289,"sourceCode":"\n    // /// Updates (or inserts) the file content in the WASM project.\n    // pub fn upsert_file(&mut self, file_path: &str, content: Option<String>) {\n    //     self.baml_project.update_file(file_path, content);\n    //     if self.current_runtime.is_some() {\n    //         self.last_successful_runtime = self.current_runtime.take();\n    //     }\n    // }\n\n    pub fn handle_hover_request(\n        &mut self,\n        doc: &TextDocumentItem,\n        position: &Position,\n        notifier: Notifier,\n        feature_flags: &[String],\n    ) -> anyhow::Result<Option<Hover>> {\n        // Force runtime update before handling hover\n        self.update_runtime(Some(notifier), feature_flags)\n            .map_err(|e| anyhow::anyhow!(\"Failed to update runtime: {e}\"))?;\n\n        let word = get_word_at_position(&doc.text, position);\n        let cleaned_word = trim_line(&word);\n        if cleaned_word.is_empty() {\n            return Ok(None);\n        }\n        let rt = self\n            .runtime()\n            .map_err(|e| anyhow::anyhow!(\"Failed to generate a runtime: {e}\"))?;\n        let maybe_symbol = rt.search_for_symbol(&cleaned_word);\n        match maybe_symbol {\n            None => Ok(None),\n            Some(symbol_location) => {\n                let range = Range {\n                    start: Position {\n                        line: symbol_location.start_line as u32,\n                        character: symbol_location.start_character as u32,\n                    },","sourceCodeStart":1271,"sourceCodeEnd":1307,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_server/src/baml_project/mod.rs#L1271-L1307","documentation":"This error wraps any failure from `update_runtime` when the language server forces a runtime rebuild before handling a hover request. The BAML project's in-memory runtime (compiled from .baml files) is stale or could not be regenerated, so hover analysis cannot proceed. The original `update_runtime` error message is embedded in `{e}`.","triggerScenarios":"Hover request (textDocument/hover) arrives and `BamlProject::update_runtime` fails — typically because baml_src files fail to compile (schema/generator errors), the baml_src path is misconfigured, or the runtime construction returns Err.","commonSituations":"A .baml file has a syntax or type error; the client edited files that broke the project; baml_src directory moved or was renamed so the runtime cannot be built; generator configuration invalid so runtime generation fails.","solutions":["Fix the underlying compile error reported inside {e} in your .baml files (the wrapped message names the real cause).","Verify the baml_src directory path is correctly configured for the workspace root.","Save the broken file again after fixing so the editor triggers a fresh runtime update.","Restart the language server if the project state is inconsistent after large file moves."],"exampleFix":"// before: .baml file with type error\nclass Foo { name stringy }\n// after: fix the type\nclass Foo { name string }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Server-side wrap already in place; clients should inspect the inner error\nmatch hover_result {\n    Err(e) if e.to_string().contains(\"Failed to update runtime\") => {\n        log::warn!(\"runtime stale: {e}\"); // surface inner cause to user\n    }\n    _ => {}\n}","preventionTips":["Keep .baml files compiling cleanly before invoking editor features.","Keep baml_src path configuration stable and correct.","Watch earlier diagnostics; they usually explain the wrapped cause."],"tags":["lsp","hover","runtime","baml"],"backgroundTag":"invalid-state-transition","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}