BoundaryML/baml · error · LspError
{0}
Error message
{0} What it means
LspError::NotificationExtractError wraps an lsp_server::ExtractError<Notification> raised when an incoming LSP notification cannot be deserialized or matched to a known method. thiserror renders it transparently with `{0}`. It is reported through LspError::to_response_error.
Source
Thrown at baml_language/crates/baml_lsp/src/error.rs:11
//! The one LSP error type and its JSON-RPC code table.
use std::path::PathBuf;
/// Every failure a request or notification handler can report.
///
/// Serialized to the wire exclusively through [`LspError::to_response_error`];
/// the legacy `-32001 UnknownErrorCode` is never emitted.
#[derive(Debug, thiserror::Error)]
pub enum LspError {
#[error("{0}")]
NotificationExtractError(lsp_server::ExtractError<lsp_server::Notification>),
#[error("Notification not supported: {0}")]
NotificationNotSupported(String),
#[error("{0}")]
RequestExtractError(lsp_server::ExtractError<lsp_server::Request>),
#[error("Request not supported: {0}")]
RequestNotSupported(String),
#[error("Failed to serialize request result: {0}")]
RequestSerializeError(serde_json::Error),
/// The client's sink is gone; nothing more can be delivered.
#[error("Client closed")]
ClientClosed,
/// Bounded transport backpressure (LSP `RequestFailed`, `-32803`).
#[error("LSP outbound sink is saturated")]
OutboundSaturated,
/// A frame larger than the transport limit (LSP `RequestFailed`,
/// `-32803`).
#[error("LSP outbound frame exceeds the transport limit")]View on GitHub (pinned to bd85ce9dee)
Solutions
- Check that the LSP client and server speak compatible LSP versions and schemas
- Log the raw notification payload to identify the malformed field
- Verify no custom notifications are being sent without matching registration
Defensive patterns
Strategy: try-catch
Type guard
fn is_notification_extract_err(e: &LspError) -> bool {
matches!(e, LspError::NotificationExtractError(_))
} Try / catch
match result {
Err(LspError::NotificationExtractError(e)) => log::warn!("bad notification: {e}"),
other => other?,
} Prevention
- Pin matching versions of lsp_server on both sides of the connection
- Log raw JSON-RPC frames in debug builds to catch schema drift early
When it happens
Trigger: A notification arrives with a JSON body that fails serde deserialization into the expected lsp_server::Notification shape, or a handler calls an extraction API on a message that is not the expected notification.
Common situations: A client/server version mismatch producing unknown notification payloads; malformed JSON-RPC frames from a buggy client; custom extensions sending nonstandard notification shapes.
Related errors
- Notification not supported: {0}
- Request not supported: {0}
- Failed to serialize request result: {0}
- no filesystem is attached to this server ({})
- Client closed
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/6c63d58999fed6ac.
Report an issue: GitHub.