LSP client sends shutdown with params: {}; rust-analyzer rejects it and the client never sends exit

Status Fixed / completed
Reported on v2.1.266
Maintainer reply None cached
Activity 0 comments · opened Sep 9, 2026 · closed Sep 10, 2026

What's Wrong?

The LSP client sends the shutdown request with "params": {}. LSP defines shutdown with no params. rust-analyzer (the lsp-server crate deserializes the params as unit) answers with an error, -32602 Failed to deserialize shutdown: invalid type: map, expected unit; {}, Claude Code logs Failed to stop LSP server '…': … and disconnects without sending exit. The server is left to notice the closed pipe on its own. gopls, pyright and nixd accept the extra {}, so this is visible only with strict servers, but any plugin that runs rust-analyzer hits it on every session end.

What Should Happen?

Send shutdown without params (or with null), and send exit after the shutdown response whether it succeeded or not, as the specification's shutdown sequence requires.

Error Messages/Logs

From --debug-file, 2.1.266:

[LSP PROTOCOL plugin:…:rust-analyzer] Sending request 'shutdown - (2)'.
[LSP PROTOCOL plugin:…:rust-analyzer] Received response 'shutdown - (2)' in 2ms. Request failed: Failed to deserialize shutdown: invalid type: map, expected unit; {} (-32602).
[ERROR] Failed to stop LSP server 'plugin:…:rust-analyzer': Failed to deserialize shutdown: invalid type: map, expected unit; {}

The raw request, recorded on the server's stdin: {"jsonrpc":"2.0","id":2,"method":"shutdown","params":{}}. No exit follows.

Steps to Reproduce

  1. A plugin whose .lsp.json runs rust-analyzer (any version; 2026-08-03 here) for .rs, and a Cargo project.
  2. claude -p "Use the LSP tool once: findReferences on src/lib.rs line 1 column 8" --plugin-dir <plugin> --allowedTools LSP --debug-file /tmp/cc.log
  3. grep -n shutdown /tmp/cc.log. To see the raw request, put a recorder in the server's place: https://github.com/tagawa0525/lsp-det/tree/main/scripts/claude-code/tee-probe

Claude Model any (the LSP client is model-independent; Sonnet here)

Is this a regression? No (same on 2.1.259, 2.1.261, 2.1.263, 2.1.266)

Claude Code Version 2.1.266

Platform CLI. Operating System Linux (NixOS). Terminal/Shell bash

View original on GitHub ↗