astral-sh/ruff · error · anyhow::Error

Failed to send response: {error}

Error message

Failed to send response: {error}

What it means

Error "Failed to send response: {error}" thrown in astral-sh/ruff.

Source

Thrown at crates/ruff_server/src/session/client.rs:165

            .map_err(|error| anyhow!("Failed to send response for request {id}: {error}"))
    }

    /// Sends an error response to the client for a given request ID.
    ///
    /// The response isn't sent immediately. Instead, it's queued up in the main loop.
    pub(crate) fn respond_err(
        &self,
        id: RequestId,
        error: lsp_server::ResponseError,
    ) -> crate::Result<()> {
        let response = lsp_server::Response {
            id,
            response_result: Err(error),
        };

        self.main_loop_sender
            .send(Event::SendResponse(response))
            .map_err(|error| anyhow!("Failed to send response: {error}"))
    }

    /// Shows a message to the user.
    ///
    /// This opens a pop up in VS Code showing `message`.
    pub(crate) fn show_message(
        &self,
        message: impl Display,
        message_type: lsp_types::MessageType,
    ) -> crate::Result<()> {
        self.send_notification::<lsp_types::ShowMessageNotification>(lsp_types::ShowMessageParams {
            kind: message_type,
            message: message.to_string(),
        })
    }

    /// Sends a request to display a warning to the client with a formatted message. The warning is
    /// sent in a `window/showMessage` notification.

View on GitHub (pinned to 672bb4edf0)

When it happens

Trigger: Thrown at crates/ruff_server/src/session/client.rs:165 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16). Data as JSON: /api/errors/203b52e6a14fe7f1. Report an issue: GitHub.