{"record":{"id":"a3f41c411b4bbbae","repo":"BoundaryML/baml","slug":"failed-to-generate-a-runtime-e","errorCode":null,"errorMessage":"Failed to generate a runtime: {e}","messagePattern":"Failed to generate a runtime: (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"engine/language_server/src/baml_project/mod.rs","lineNumber":1298,"sourceCode":"    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                    },\n                    end: Position {\n                        line: symbol_location.end_line as u32,\n                        character: symbol_location.end_character as u32,\n                    },\n                };\n\n                let symbol_doc = self\n                    .files()\n                    .get(&symbol_location.uri)","sourceCodeStart":1280,"sourceCodeEnd":1316,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_server/src/baml_project/mod.rs#L1280-L1316","documentation":"After updating the runtime, hover requests call `runtime()` to obtain the generated runtime; if that accessor returns Err (no valid runtime is currently built for the project), this error is thrown. Unlike 1550, the runtime update succeeded or was skipped, but no usable runtime instance exists for symbol lookup.","triggerScenarios":"`handle_hover_request` calls `self.runtime()` and it returns Err — e.g. runtime generation previously failed and no cached runtime is available, or the project has no successfully built runtime yet.","commonSituations":"Project never compiled successfully (initial broken state); runtime was invalidated by a file change and regeneration failed; opening hover in a workspace with zero valid .baml sources.","solutions":["Fix the runtime-generation failure reported by prior diagnostics in the .baml sources.","Ensure at least one valid baml_src directory with compilable .baml files exists in the project.","Restart the language server to force a clean runtime build.","Check the server log for the original runtime construction error."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"let rt = match project.runtime() {\n    Ok(rt) => rt,\n    Err(e) => {\n        tracing::warn!(\"no runtime yet: {e}\");\n        return Ok(None); // degrade gracefully: no hover instead of hard error\n    }\n};","preventionTips":["Fix runtime generation errors surfaced in diagnostics first.","Ensure a valid baml_src directory exists in every workspace.","Restart the server after large refactors to rebuild runtime state."],"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"}