astral-sh/ruff · error · Error

-32601

-32601

Error message

Unknown request: {method}

What it means

Returned by the ty server's request dispatcher when an LSP request arrives whose method is not one of the registered handlers. The server answers the client with a MethodNotFound-style error instead of crashing; unknown notifications are ignored.

Solutions

  1. Send only methods advertised in the server's capabilities
  2. Register a handler for the method before dispatching it
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/ty_server/src/server/api.rs:156 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astral-sh/ruff@26f38c119c (2026-09-05). Data as JSON: /api/errors/a376e437a4b26d25. Report an issue: GitHub.

Appendix: source

Thrown at crates/ty_server/src/server/api.rs:156

        ),
        requests::CallHierarchyIncomingCallsRequestHandler::METHOD => {
            background_request_task::<requests::CallHierarchyIncomingCallsRequestHandler>(
                req,
                BackgroundSchedule::Worker,
            )
        }
        requests::CallHierarchyOutgoingCallsRequestHandler::METHOD => {
            background_request_task::<requests::CallHierarchyOutgoingCallsRequestHandler>(
                req,
                BackgroundSchedule::Worker,
            )
        }
        lsp_types::ShutdownRequest::METHOD => sync_request_task::<requests::ShutdownHandler>(req),

        method => {
            tracing::warn!("Received request {method} which does not have a handler");
            let result: Result<()> = Err(Error::new(
                anyhow!("Unknown request: {method}"),
                server::ErrorCode::MethodNotFound,
            ));
            return Task::immediate(id, result);
        }
    }
    .unwrap_or_else(|err| {
        tracing::error!("Encountered error when routing request with ID {id}: {err}");

        Task::sync(move |session, client| {
            if matches!(err.code, ErrorCode::InternalError) {
                client.show_error_message(format!(
                    "ty failed to handle a request from the editor. {}",
                    session.client_name().log_guidance()
                ));
            }

            respond_silent_error(
                id,

View on GitHub (pinned to 26f38c119c)