[BUG] LSP query operations return empty results on Windows despite server responding (diagnostics work)

Resolved 💬 5 comments Opened Mar 8, 2026 by WBNorth Closed Apr 17, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

On Windows, Pyright LSP server spawns, initializes, and responds to all requests within milliseconds — but every interactive query (hover, goToDefinition, findReferences, documentSymbol, workspaceSymbol) returns null/empty results. Diagnostics flow correctly for the same files, proving Pyright is analyzing the code.

Response times (1-2ms for hover, 2ms for documentSymbol) suggest Pyright is receiving positions where no symbol exists and correctly returning null. The likely cause is incorrect line/character position mapping in Claude Code's LSP tool when translating symbol names to file positions. Diagnostics don't require positions (server pushes them after scanning the whole file), which is why they work.

Additionally, npm-installed Pyright fails with spawn pyright-langserver ENOENT because npm creates .cmd wrappers on Windows which child_process.spawn() can't resolve without shell: true. Pip-installed Pyright (pyright-langserver.exe) resolves this.

What Should Happen?

All LSP query operations should resolve symbols and return results on Windows, same as on Mac/Linux. Position mapping from symbol names to line/character coordinates should account for any Windows-specific path or encoding differences.

npm-installed language servers should also work on Windows without requiring pip as a workaround.

Error Messages/Logs

# pyright-lsp plugin: server loads, connects, responds — but all results shown as empty
  # Platform: Windows 11 Pro, pyright 1.1.408 (pip), Claude Code latest
  # Plugin: pyright-lsp@claude-plugins-official v1.0.0

  # ── Plugin loading ──
  2026-03-08T23:23:05.222Z [DEBUG] Loading plugin pyright-lsp from source: "./plugins/pyright-lsp"
  2026-03-08T23:23:05.223Z [DEBUG] Using provided version for pyright-lsp@claude-plugins-official: 1.0.0
  2026-03-08T23:23:05.223Z [DEBUG] Plugin pyright-lsp@claude-plugins-official version 1.0.0 already cached at
  C:\Users\walt\.claude\plugins\cache\claude-plugins-official\pyright-lsp\1.0.0
  2026-03-08T23:23:05.223Z [DEBUG] Resolved local plugin pyright-lsp to versioned cache:
  C:\Users\walt\.claude\plugins\cache\claude-plugins-official\pyright-lsp\1.0.0

  # ── LSP manager init (lazy — server not spawned yet) ──
  2026-03-08T23:23:05.521Z [DEBUG] [LSP MANAGER] initializeLspServerManager() called
  2026-03-08T23:23:05.521Z [DEBUG] [LSP MANAGER] Created manager instance, state=pending
  2026-03-08T23:23:05.521Z [DEBUG] [LSP MANAGER] Starting async initialization (generation 1)
  2026-03-08T23:23:05.626Z [DEBUG] Loaded 1 LSP server(s) from plugin: pyright-lsp
  2026-03-08T23:23:05.626Z [DEBUG] Total LSP servers loaded: 1
  2026-03-08T23:23:05.626Z [DEBUG] [LSP SERVER MANAGER] getAllLspServers returned 1 server(s)
  2026-03-08T23:23:05.626Z [DEBUG] Queued request handler for plugin:pyright-lsp:pyright.workspace/configuration
  (connection not ready)
  2026-03-08T23:23:05.626Z [DEBUG] LSP manager initialized with 1 servers
  2026-03-08T23:23:05.626Z [DEBUG] LSP server manager initialized successfully
  2026-03-08T23:23:05.626Z [DEBUG] Queued notification handler for
  plugin:pyright-lsp:pyright.textDocument/publishDiagnostics (connection not ready)
  2026-03-08T23:23:05.626Z [DEBUG] Registered diagnostics handler for plugin:pyright-lsp:pyright
  2026-03-08T23:23:05.626Z [DEBUG] LSP notification handlers registered successfully for all 1 server(s)

  # ── Diagnostics polled repeatedly before first LSP tool call — always 0 ──
  2026-03-08T23:23:16.163Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
  2026-03-08T23:23:16.164Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
  # ... (repeated ~15 times through 23:27:58, always 0 pending)

  # ── First LSP tool call triggers server spawn ──
  2026-03-08T23:28:01.142Z [DEBUG] executePreToolHooks called for tool: LSP
  2026-03-08T23:28:01.145Z [DEBUG] Starting LSP server instance: plugin:pyright-lsp:pyright
  2026-03-08T23:28:01.150Z [DEBUG] Applied queued notification handler for
  plugin:pyright-lsp:pyright.textDocument/publishDiagnostics
  2026-03-08T23:28:01.150Z [DEBUG] Applied queued request handler for plugin:pyright-lsp:pyright.workspace/configuration
  2026-03-08T23:28:01.150Z [DEBUG] LSP client started for plugin:pyright-lsp:pyright

  # ── Server initializes successfully (215ms) ──
  2026-03-08T23:28:01.150Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'initialize - (0)'.
  2026-03-08T23:28:01.365Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'initialize - (0)' in
  215ms.
  2026-03-08T23:28:01.365Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending notification 'initialized'.
  2026-03-08T23:28:01.365Z [DEBUG] LSP server plugin:pyright-lsp:pyright initialized
  2026-03-08T23:28:01.365Z [DEBUG] LSP server instance started: plugin:pyright-lsp:pyright

  # ── didOpen + first hover: server responds (107ms) — Claude shows "No hover information" ──
  2026-03-08T23:28:01.365Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending notification
  'textDocument/didOpen'.
  2026-03-08T23:28:01.366Z [DEBUG] LSP: Sent didOpen for F:\ChasingRainbows\_Apps\PUniverse\apps\skins\__init__.py
  (languageId: python)
  2026-03-08T23:28:01.366Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'textDocument/hover - (1)'.
  2026-03-08T23:28:01.473Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'textDocument/hover -
  (1)' in 107ms.

  # ── Diagnostics arrive 236ms after didOpen — 6 issues found (proves pyright IS analyzing) ──
  2026-03-08T23:28:01.709Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received notification
  'textDocument/publishDiagnostics'.
  2026-03-08T23:28:01.709Z [DEBUG] [PASSIVE DIAGNOSTICS] Handler invoked for plugin:pyright-lsp:pyright! Params type:
  object
  2026-03-08T23:28:01.709Z [DEBUG] Received diagnostics from plugin:pyright-lsp:pyright: 6 diagnostic(s) for
  file://f:\chasingrainbows\_apps\puniverse\apps\skins\__init__.py/
  2026-03-08T23:28:01.709Z [DEBUG] LSP Diagnostics: Registering 1 diagnostic file(s) from plugin:pyright-lsp:pyright
  2026-03-08T23:28:01.709Z [DEBUG] LSP Diagnostics: Registered 1 diagnostic file(s) from plugin:pyright-lsp:pyright for
  async delivery

  # ── Subsequent requests: all get responses, all shown as empty ──
  # hover (2): response in 2ms  → "No hover information available"
  2026-03-08T23:28:05.131Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'textDocument/hover - (2)'.
  2026-03-08T23:28:05.133Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'textDocument/hover -
  (2)' in 2ms.

  # hover (3): response in 1ms  → "No hover information available"
  2026-03-08T23:28:09.897Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'textDocument/hover - (3)'.
  2026-03-08T23:28:09.898Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'textDocument/hover -
  (3)' in 1ms.

  # hover (4): response in 2ms  → "No hover information available"
  2026-03-08T23:28:12.919Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'textDocument/hover - (4)'.
  2026-03-08T23:28:12.921Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'textDocument/hover -
  (4)' in 2ms.

  # documentSymbol (5): response in 2ms → "No symbols found in document"
  2026-03-08T23:28:15.843Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request
  'textDocument/documentSymbol - (5)'.
  2026-03-08T23:28:15.845Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response
  'textDocument/documentSymbol - (5)' in 2ms.

  # hover (6): response in 1ms  → "No hover information available"
  2026-03-08T23:28:19.757Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'textDocument/hover - (6)'.
  2026-03-08T23:28:19.758Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'textDocument/hover -
  (6)' in 1ms.

  # definition (7): response in 19ms → "No definition found"
  2026-03-08T23:28:26.148Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'textDocument/definition -
  (7)'.
  2026-03-08T23:28:26.167Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'textDocument/definition
  - (7)' in 19ms.

  # references (8): response in 6ms → "No references found"
  2026-03-08T23:28:26.892Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'textDocument/references -
  (8)'.
  2026-03-08T23:28:26.898Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'textDocument/references
  - (8)' in 6ms.

  # workspaceSymbol (9): response in 7ms → "No symbols found in workspace"
  2026-03-08T23:28:32.226Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Sending request 'workspace/symbol - (9)'.
  2026-03-08T23:28:32.233Z [DEBUG] [LSP PROTOCOL plugin:pyright-lsp:pyright] Received response 'workspace/symbol - (9)'
  in 7ms.

  # ── Diagnostics delivery (between requests 2 and 3) — this part works ──
  2026-03-08T23:28:05.147Z [DEBUG] LSP Diagnostics: Checking registry - 1 pending
  2026-03-08T23:28:05.147Z [DEBUG] LSP Diagnostics: Delivering 1 file(s) with 6 diagnostic(s) from 1 server(s)
  2026-03-08T23:28:05.147Z [DEBUG] LSP Diagnostics: Cleared 1 delivered diagnostic(s) from registry
  2026-03-08T23:28:05.147Z [DEBUG] LSP Diagnostics: Returning 1 diagnostic attachment(s)

  Revised diagnosis: The server spawns, initializes, and responds to every request. The problem is that pyright returns
  null/empty results for all interactive queries (hover, definition, references, documentSymbol, workspaceSymbol) while
  simultaneously returning valid diagnostics for the same file. Either pyright is returning null payloads (possible race
   with indexing, though requests 2-9 are well after diagnostics arrive), or Claude Code is discarding valid response
  data during deserialization.

Steps to Reproduce

Windows 11, Claude Code latest
pip install pyright (npm install fails with ENOENT — see above)
Set ENABLE_LSP_TOOL: "1" in ~/.claude/settings.json env block
Install pyright-lsp plugin via /plugin → Discover
Restart Claude Code, verify Total LSP servers loaded: 1 in debug log
Ask Claude to perform any LSP operation on a Python file: hover, goToDefinition, findReferences, documentSymbol, workspaceSymbol
All return zero results. Diagnostics for the same file return correctly (6 issues found in test file)

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.170

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Two separate Windows issues here: (1) npm .cmd wrapper resolution failing on spawn, (2) position mapping returning empty results with pip-installed exe. Issue 2 is the primary bug — the server works, the pipe works, the responses arrive, but the query positions appear wrong.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗