{"record":{"id":"23a7bc26890cebf8","repo":"BoundaryML/baml","slug":"internalerror-did-change-err","errorCode":"InternalError","errorMessage":"did_change err: {}","messagePattern":"did_change err: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_server/src/server/api/diagnostics.rs","lineNumber":124,"sourceCode":"    let default_flags = vec![\"beta\".to_string()];\n    let feature_flags = session\n        .baml_settings\n        .feature_flags\n        .as_ref()\n        .unwrap_or(&default_flags);\n    tracing::info!(\n        \"publish_diagnostics_for_file: session feature_flags: {:?}\",\n        feature_flags\n    );\n    let diagnostics = project_diagnostics(project.clone(), feature_flags, session);\n    for (uri, diagnostics) in diagnostics {\n        notifier\n            .notify::<lsp_types::notification::PublishDiagnostics>(PublishDiagnosticsParams {\n                uri: uri.clone(),\n                version: None,\n                diagnostics,\n            })\n            .map_err(|e| anyhow::anyhow!(\"did_change err: {}\", e))\n            .internal_error()?;\n    }\n    Ok(())\n}\n\npub fn project_diagnostics(\n    project: Arc<Mutex<Project>>,\n    feature_flags: &[String],\n    session: &Session,\n) -> HashMap<Url, Vec<lsp_types::Diagnostic>> {\n    tracing::info!(\n        \"project_diagnostics called with feature_flags: {:?}\",\n        feature_flags\n    );\n    let mut guard = project.lock();\n    let root_path = PathBuf::from(guard.root_path());\n    let fake_env = HashMap::new();\n    let baml_diagnostics = match guard.baml_project.runtime(fake_env, feature_flags) {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_server/src/server/api/diagnostics.rs#L106-L142","documentation":"`publish_session_lsp_diagnostics` sends `textDocument/publishDiagnostics` notifications to the client; if the notifier fails (the transport/channel to the editor is broken or closed), the send error is wrapped as \"did_change err: {e}\" and marked as an InternalError. This is a server-to-client notification failure, not a problem with the diagnostics themselves.","triggerScenarios":"Called from `run` while publishing diagnostics after a did_change; the underlying notification channel returns Err — client disconnected, connection dropped, or serialization/transport failure.","commonSituations":"Editor closed or reloaded while the server was still publishing; flaky LSP pipe/socket; server outliving its client session.","solutions":["Verify the editor client is still connected; restart the language server session.","Check server logs for transport-level errors preceding this message.","Reopen the file to trigger a fresh diagnostics publish.","Update the BAML extension/server if the issue reproduces on every edit."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = notifier.notify::<PublishDiagnostics>(params) {\n    tracing::warn!(\"publish failed (client gone?): {e}\");\n    // do not crash: client reconnect will re-request diagnostics\n}","preventionTips":["Keep the editor session alive while the server publishes.","Treat diagnostics-publish failures as non-fatal (log + continue).","Update the extension if transport errors recur on every keystroke."],"tags":["lsp","diagnostics","notification","baml"],"backgroundTag":"broken-pipe","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"}