oraios/serena · critical · RuntimeError

Language server is missing required capabilities: {', '.join

Error message

Language server is missing required capabilities: {', '.join(missing)}. Initialization failed. Please ensure the correct version of Microsoft.CodeAnalysis.LanguageServer is installed and the .NET runtime is working.

What it means

This RuntimeError is raised during C# language server initialization when the Microsoft.CodeAnalysis.LanguageServer process completes initialization but does not advertise all required LSP capabilities (completion, hover, definition, references, document symbols, etc.). It indicates the server binary, .NET runtime, or server version is broken or incompatible, so Serena aborts startup rather than operate with a degraded server.

Source

Thrown at src/solidlsp/language_servers/csharp_language_server.py:688

            init_response = self.server.send.initialize(initialize_params)
            log.info(f"Received initialize response: {init_response}")
        except Exception as e:
            raise SolidLSPException(f"Failed to initialize C# language server for {self.repository_root_path}: {e}") from e

        # Apply diagnostic capabilities
        self._force_pull_diagnostics(init_response)

        # Verify required capabilities
        capabilities = init_response.get("capabilities", {})
        required_capabilities = [
            "textDocumentSync",
            "definitionProvider",
            "referencesProvider",
            "documentSymbolProvider",
        ]
        missing = [cap for cap in required_capabilities if cap not in capabilities]
        if missing:
            raise RuntimeError(
                f"Language server is missing required capabilities: {', '.join(missing)}. "
                "Initialization failed. Please ensure the correct version of Microsoft.CodeAnalysis.LanguageServer is installed and the .NET runtime is working."
            )

        # Complete initialization
        self.server.notify.initialized({})

        # Open solution and project files
        self._open_solution_and_projects()

        log.info(
            "Microsoft.CodeAnalysis.LanguageServer initialized and ready\n"
            "Waiting for language server to index project files...\n"
            "This may take a while for large projects"
        )

        if indexing_complete.wait(30):  # Wait up to 30 seconds for indexing
            log.info("Indexing complete")

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Verify the .NET runtime is installed and working: run 'dotnet --info' and install the required .NET SDK/runtime if missing.
  2. Delete the cached language-server resources directory and restart so Microsoft.CodeAnalysis.LanguageServer is re-downloaded cleanly.
  3. Check the installed Microsoft.CodeAnalysis.LanguageServer version; pin/update to a version compatible with your Serena/SolidLSP release.
  4. Run the language server binary manually to see startup errors (missing shared libraries, permission issues).
  5. Check network/proxy settings if the server download was interrupted, then retry installation.

Example fix

// before (broken env)
$ dotnet --info
bash: dotnet: command not found
// after
$ sudo apt-get install -y dotnet-sdk-8.0
$ dotnet --info   # then restart the language server
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil, subprocess
if shutil.which('dotnet') is None:
    raise SystemExit('Install the .NET runtime before starting the C# language server')
subprocess.run(['dotnet', '--info'], check=True, capture_output=True)

Type guard

def server_has_capabilities(caps: dict, required: set[str]) -> bool:
    return required.issubset(caps.keys())

Try / catch

try:
    ls = SolidLSP(csharp_config)
    ls.start()
except RuntimeError as e:
    if 'missing required capabilities' in str(e):
        clear_cached_language_server_resources()
        ensure_dotnet_runtime()
        ls = SolidLSP(csharp_config); ls.start()
    else:
        raise

Prevention

When it happens

Trigger: Calling SolidLSP/C# language server startup (_start_server) when the initialized server's capabilities response lacks any capability in required_capabilities, e.g. because Microsoft.CodeAnalysis.LanguageServer failed to fully start, a wrong/incompatible version was downloaded, or the .NET runtime is missing/broken so the server partially initialized.

Common situations: Corrupted or partial download of Microsoft.CodeAnalysis.LanguageServer; missing or mismatched .NET runtime; using an old/new server version whose capabilities changed; running on an unsupported platform where the server binary silently fails; network proxy producing a truncated install.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/6a28fd7503cf4c8a. Report an issue: GitHub.