{"record":{"id":"6c63d58999fed6ac","repo":"BoundaryML/baml","slug":"0-error","errorCode":null,"errorMessage":"{0}","messagePattern":"\\{0\\}","errorType":"exception","errorClass":"LspError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_lsp/src/error.rs","lineNumber":11,"sourceCode":"//! The one LSP error type and its JSON-RPC code table.\n\nuse std::path::PathBuf;\n\n/// Every failure a request or notification handler can report.\n///\n/// Serialized to the wire exclusively through [`LspError::to_response_error`];\n/// the legacy `-32001 UnknownErrorCode` is never emitted.\n#[derive(Debug, thiserror::Error)]\npub enum LspError {\n    #[error(\"{0}\")]\n    NotificationExtractError(lsp_server::ExtractError<lsp_server::Notification>),\n    #[error(\"Notification not supported: {0}\")]\n    NotificationNotSupported(String),\n    #[error(\"{0}\")]\n    RequestExtractError(lsp_server::ExtractError<lsp_server::Request>),\n    #[error(\"Request not supported: {0}\")]\n    RequestNotSupported(String),\n    #[error(\"Failed to serialize request result: {0}\")]\n    RequestSerializeError(serde_json::Error),\n    /// The client's sink is gone; nothing more can be delivered.\n    #[error(\"Client closed\")]\n    ClientClosed,\n    /// Bounded transport backpressure (LSP `RequestFailed`, `-32803`).\n    #[error(\"LSP outbound sink is saturated\")]\n    OutboundSaturated,\n    /// A frame larger than the transport limit (LSP `RequestFailed`,\n    /// `-32803`).\n    #[error(\"LSP outbound frame exceeds the transport limit\")]","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_lsp/src/error.rs#L1-L29","documentation":"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.","triggerScenarios":"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.","commonSituations":"A client/server version mismatch producing unknown notification payloads; malformed JSON-RPC frames from a buggy client; custom extensions sending nonstandard notification shapes.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_notification_extract_err(e: &LspError) -> bool {\n    matches!(e, LspError::NotificationExtractError(_))\n}","tryCatchPattern":"match result {\n    Err(LspError::NotificationExtractError(e)) => log::warn!(\"bad notification: {e}\"),\n    other => other?,\n}","preventionTips":["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"],"tags":["lsp","deserialization","rust","json-rpc"],"backgroundTag":"unexpected-response-shape","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"}