LSP plugin servers not registered due to initialization race condition

Resolved 💬 3 comments Opened Dec 29, 2025 by Dlaranjo Closed Dec 29, 2025

Bug Description

LSP plugins (e.g., pyright-lsp) are loaded but their LSP servers are never registered because the LSP server manager initializes before plugins are loaded.

Environment

  • OS: Linux (WSL2) - Linux 6.6.87.2-microsoft-standard-WSL2
  • Node.js: v20.19.3
  • Plugin: pyright-lsp@claude-plugins-official v1.0.0
  • Pyright: 1.1.407 (installed via npm install -g pyright)

Steps to Reproduce

  1. Install the pyright-lsp plugin: /plugin install pyright-lsp
  2. Install pyright: npm install -g pyright
  3. Verify pyright-langserver is in PATH: which pyright-langserver
  4. Verify plugin is enabled in ~/.claude/settings.json:

``json
{
"enabledPlugins": {
"pyright-lsp@claude-plugins-official": true
}
}
``

  1. Restart Claude Code
  2. Try any LSP operation on a Python file

Expected Behavior

LSP operations (hover, goToDefinition, findReferences, etc.) should work on Python files.

Actual Behavior

All LSP operations return: No LSP server available for file type: .py

Root Cause (from debug logs)

The debug log at ~/.claude/debug/latest shows a race condition:

2025-12-29T20:29:36.118Z [DEBUG] LSP server manager initialized successfully
2025-12-29T20:29:36.118Z [DEBUG] LSP notification handlers registered successfully for all 0 server(s)
2025-12-29T20:29:36.123Z [DEBUG] Loading plugin pyright-lsp from source: "./plugins/pyright-lsp"
2025-12-29T20:29:36.124Z [DEBUG] Using provided version for pyright-lsp@claude-plugins-official: 1.0.0

The LSP server manager initializes at .118Z with 0 servers, then the pyright-lsp plugin loads at .123Z (5ms later). The plugin's lspServers configuration from marketplace.json is never registered with the already-initialized LSP manager.

Plugin Configuration (from marketplace.json)

The plugin is correctly defined with LSP server config:

{
  "name": "pyright-lsp",
  "lspServers": {
    "pyright": {
      "command": "pyright-langserver",
      "args": ["--stdio"],
      "extensionToLanguage": {
        ".py": "python",
        ".pyi": "python"
      }
    }
  }
}

Suggested Fix

The LSP server manager should either:

  1. Initialize after all plugins are loaded, or
  2. Re-register LSP servers after plugins finish loading, or
  3. Use a deferred/lazy initialization pattern for LSP servers

Workarounds Attempted (none worked)

  • Reinstalling the plugin
  • Complete restart of Claude Code
  • Verifying all binaries are in PATH
  • Checking /plugin menu shows no errors

View original on GitHub ↗

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