BoundaryML/baml · error

InternalError

InternalError

Error message

did_change err: {}

What it means

`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.

Source

Thrown at engine/language_server/src/server/api/diagnostics.rs:124

    let default_flags = vec!["beta".to_string()];
    let feature_flags = session
        .baml_settings
        .feature_flags
        .as_ref()
        .unwrap_or(&default_flags);
    tracing::info!(
        "publish_diagnostics_for_file: session feature_flags: {:?}",
        feature_flags
    );
    let diagnostics = project_diagnostics(project.clone(), feature_flags, session);
    for (uri, diagnostics) in diagnostics {
        notifier
            .notify::<lsp_types::notification::PublishDiagnostics>(PublishDiagnosticsParams {
                uri: uri.clone(),
                version: None,
                diagnostics,
            })
            .map_err(|e| anyhow::anyhow!("did_change err: {}", e))
            .internal_error()?;
    }
    Ok(())
}

pub fn project_diagnostics(
    project: Arc<Mutex<Project>>,
    feature_flags: &[String],
    session: &Session,
) -> HashMap<Url, Vec<lsp_types::Diagnostic>> {
    tracing::info!(
        "project_diagnostics called with feature_flags: {:?}",
        feature_flags
    );
    let mut guard = project.lock();
    let root_path = PathBuf::from(guard.root_path());
    let fake_env = HashMap::new();
    let baml_diagnostics = match guard.baml_project.runtime(fake_env, feature_flags) {

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Verify the editor client is still connected; restart the language server session.
  2. Check server logs for transport-level errors preceding this message.
  3. Reopen the file to trigger a fresh diagnostics publish.
  4. Update the BAML extension/server if the issue reproduces on every edit.
Defensive patterns

Strategy: retry

Try / catch

if let Err(e) = notifier.notify::<PublishDiagnostics>(params) {
    tracing::warn!("publish failed (client gone?): {e}");
    // do not crash: client reconnect will re-request diagnostics
}

Prevention

When it happens

Trigger: Called from `run` while publishing diagnostics after a did_change; the underlying notification channel returns Err — client disconnected, connection dropped, or serialization/transport failure.

Common situations: Editor closed or reloaded while the server was still publishing; flaky LSP pipe/socket; server outliving its client session.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/23a7bc26890cebf8. Report an issue: GitHub.