{"record":{"id":"6a28fd7503cf4c8a","repo":"oraios/serena","slug":"language-server-is-missing-required-capabilities","errorCode":null,"errorMessage":"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.","messagePattern":"Language server is missing required capabilities: (.+?)\\. Initialization failed\\. Please ensure the correct version of Microsoft\\.CodeAnalysis\\.LanguageServer is installed and the \\.NET runtime is working\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/solidlsp/language_servers/csharp_language_server.py","lineNumber":688,"sourceCode":"            init_response = self.server.send.initialize(initialize_params)\n            log.info(f\"Received initialize response: {init_response}\")\n        except Exception as e:\n            raise SolidLSPException(f\"Failed to initialize C# language server for {self.repository_root_path}: {e}\") from e\n\n        # Apply diagnostic capabilities\n        self._force_pull_diagnostics(init_response)\n\n        # Verify required capabilities\n        capabilities = init_response.get(\"capabilities\", {})\n        required_capabilities = [\n            \"textDocumentSync\",\n            \"definitionProvider\",\n            \"referencesProvider\",\n            \"documentSymbolProvider\",\n        ]\n        missing = [cap for cap in required_capabilities if cap not in capabilities]\n        if missing:\n            raise RuntimeError(\n                f\"Language server is missing required capabilities: {', '.join(missing)}. \"\n                \"Initialization failed. Please ensure the correct version of Microsoft.CodeAnalysis.LanguageServer is installed and the .NET runtime is working.\"\n            )\n\n        # Complete initialization\n        self.server.notify.initialized({})\n\n        # Open solution and project files\n        self._open_solution_and_projects()\n\n        log.info(\n            \"Microsoft.CodeAnalysis.LanguageServer initialized and ready\\n\"\n            \"Waiting for language server to index project files...\\n\"\n            \"This may take a while for large projects\"\n        )\n\n        if indexing_complete.wait(30):  # Wait up to 30 seconds for indexing\n            log.info(\"Indexing complete\")","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/csharp_language_server.py#L670-L706","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the .NET runtime is installed and working: run 'dotnet --info' and install the required .NET SDK/runtime if missing.","Delete the cached language-server resources directory and restart so Microsoft.CodeAnalysis.LanguageServer is re-downloaded cleanly.","Check the installed Microsoft.CodeAnalysis.LanguageServer version; pin/update to a version compatible with your Serena/SolidLSP release.","Run the language server binary manually to see startup errors (missing shared libraries, permission issues).","Check network/proxy settings if the server download was interrupted, then retry installation."],"exampleFix":"// before (broken env)\n$ dotnet --info\nbash: dotnet: command not found\n// after\n$ sudo apt-get install -y dotnet-sdk-8.0\n$ dotnet --info   # then restart the language server","handlingStrategy":"try-catch","validationCode":"import shutil, subprocess\nif shutil.which('dotnet') is None:\n    raise SystemExit('Install the .NET runtime before starting the C# language server')\nsubprocess.run(['dotnet', '--info'], check=True, capture_output=True)","typeGuard":"def server_has_capabilities(caps: dict, required: set[str]) -> bool:\n    return required.issubset(caps.keys())","tryCatchPattern":"try:\n    ls = SolidLSP(csharp_config)\n    ls.start()\nexcept RuntimeError as e:\n    if 'missing required capabilities' in str(e):\n        clear_cached_language_server_resources()\n        ensure_dotnet_runtime()\n        ls = SolidLSP(csharp_config); ls.start()\n    else:\n        raise","preventionTips":["Install/verify the .NET SDK before enabling C# support ('dotnet --info').","Keep Microsoft.CodeAnalysis.LanguageServer cache directories intact; wipe them only to force a clean re-download.","Pin a server version known to work with your Serena release.","Run in an environment with uninterrupted network access to the download endpoints."],"tags":["csharp","language-server","dotnet","initialization"],"backgroundTag":"language-server-init-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}