BoundaryML/baml · warning · LspError

Request not supported: {0}

Error message

Request not supported: {0}

What it means

LspError::RequestNotSupported is produced when a request method arrives that the server does not implement. thiserror formats it as 'Request not supported: {method}'. The server converts it to a response error rather than emitting the legacy UnknownErrorCode.

Source

Thrown at baml_language/crates/baml_lsp/src/error.rs:17

//! 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")]
    OutboundOversized,
    #[error("Invalid command arguments for command: {command}: {message}")]
    InvalidCommandArguments { command: String, message: String },
    #[error("File not found: {}", .0.display())]
    FileNotFound(PathBuf),
    #[error("Path is invalid: {}: {message}", path.display())]

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Verify via initialize capabilities that the server actually supports the requested method
  2. Update the server implementation or use a client/server pair with matching feature sets
  3. Handle the error on the client side and degrade gracefully (MethodNotFound -32601 semantics)

Example fix

// before
client.sendRequest(method);
// after
if (serverCapabilities[capability]) client.sendRequest(method);
else console.warn(`server lacks ${capability}; skipping`);
Defensive patterns

Strategy: type-guard

Validate before calling

// client-side: check capabilities before issuing the request
if (!capabilities.documentFormattingProvider) {
  console.warn('server does not support textDocument/formatting');
}

Type guard

fn is_unsupported_request(e: &LspError) -> Option<&str> {
    if let LspError::RequestNotSupported(m) = e { Some(m) } else { None }
}

Try / catch

// client-side
try { await client.request(method, params); }
catch (e) { if (isMethodNotFound(e)) degradeGracefully(); else throw e; }

Prevention

When it happens

Trigger: A client issues a request (e.g. textDocument/formatting, codeAction) that the server's dispatch table lacks; a capability-related request sent despite the server not advertising it.

Common situations: Newer editor features probing methods the server predates; clients not honoring serverInfo/capabilities; misconfigured clients calling custom methods.

Related errors


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