Skip to content

bridge: LSP ServerCancelled (-32802) with retriggerRequest not retried — propagated as error to caller #128

@bug-ops

Description

@bug-ops

Description

When rust-analyzer returns LSP error code -32802 ("server cancelled the request") with data: { retriggerRequest: true }, mcpls propagates this as an opaque LspServerError to the MCP caller. The retriggerRequest: true field signals that the client should retry the request once RA is stable, but mcpls ignores this hint entirely.

This affects real users: any hover/references/diagnostics call issued just after document open may silently return an error instead of retrying. The ra_e2e suite avoids this by polling until RA is stable before making tool calls, but live MCP clients don't have that luxury.

Reproduction Steps

  1. Open a document and immediately call get_hover or get_diagnostics
  2. If RA is still indexing it returns -32802 with retriggerRequest: true
  3. mcpls logs ERROR LSP error response: server cancelled the request (code -32802) and returns an error

In tests: test_diagnostics_no_errors and test_diagnostics_with_error trigger this consistently.

Expected Behavior

When RA returns ServerCancelled with retriggerRequest: true, mcpls should retry the request (with backoff/timeout) before surfacing the error to the caller.

Actual Behavior

The error is propagated immediately to the MCP caller as LspServerError { code: -32802, message: "server cancelled the request" }.

Environment

  • HEAD: 0f40608
  • rust-analyzer: 1.95.0 (59807616 2026-04-14)

Logs / Evidence

ERROR mcpls_core::lsp::client: LSP error response: server cancelled the request (code -32802)

LSP response payload:

{"id":2,"error":{"code":-32802,"message":"server cancelled the request","data":{"retriggerRequest":true}}}

Reference

LSP 3.17 spec — ServerCancelled: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#errorCodes

Metadata

Metadata

Assignees

Labels

P2Medium: suboptimal behavior, minor inconsistencybugSomething isn't workingmcpls-coremcpls-core crate changes

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions