oraios/serena · error · SolidLSPException
Failed to initialize F# language server for {self.repository
Error message
Failed to initialize F# language server for {self.repository_root_path}: {e} What it means
SolidLSPException raised when the LSP 'initialize' request sent to the F# language server (fsautocomplete) fails or times out. The library wraps any exception from self.server.send.initialize() to add context about which repository root failed. It indicates the F# server process started but never completed the LSP handshake.
Source
Thrown at src/solidlsp/language_servers/fsharp_language_server.py:422
self.server.on_request("window/workDoneProgress/create", handle_work_done_progress_create)
log.info("Starting FsAutoComplete F# language server process")
try:
self.server.start()
except Exception as e:
log.error(f"Failed to start F# language server process: {e}")
raise SolidLSPException(f"Failed to start F# language server: {e}")
# Send initialization
initialize_params = self._create_initialize_params()
log.info("Sending initialize request to F# language server")
try:
self.server.send.initialize(initialize_params)
log.debug("Received initialize response from F# language server")
except Exception as e:
raise SolidLSPException(f"Failed to initialize F# language server for {self.repository_root_path}: {e}") from e
# Complete initialization
self.server.notify.initialized({})
log.info("F# language server initialized successfully")
@override
def _get_wait_time_for_cross_file_referencing(self) -> float:
"""
F# projects can be large and may need more time for cross-file analysis.
"""
return 15.0 # 15 seconds should be sufficient for most F# projects
View on GitHub (pinned to 7fcbca7e62)
Solutions
- Run `dotnet tool list -g` / reinstall fsautocomplete (`dotnet tool install --global fsautocomplete`) and verify `fsautocomplete --version` works
- Verify the target F# project builds (`dotnet build`) — broken fsproj/sln files crash the server during initialize
- Increase the LSP startup timeout in the environment to rule out slow first-run .NET JIT/restore
- Reproduce manually by launching fsautocomplete and sending an initialize request; inspect stderr for the underlying exception
Example fix
// before (no version pin, broken tool) dotnet tool install --global fsautocomplete // after (reinstall clean and verify) dotnet tool uninstall --global fsautocomplete dotnet tool install --global fsautocomplete fsautocomplete --version
Defensive patterns
Strategy: try-catch
Validate before calling
import shutil, subprocess
def ensure_fsautocomplete_ready():
if not shutil.which('fsautocomplete'):
raise FileNotFoundError('fsautocomplete not on PATH')
subprocess.run(['dotnet', '--version'], check=True, capture_output=True) Type guard
def is_fsharp_project(root: str) -> bool:
import os
return os.path.isdir(root) and any(f.endswith(('.fsproj', '.sln')) for f in os.listdir(root)) Try / catch
from solidlsp import SolidLSPException
try:
ls = FsharpLanguageServer(repo_root, ...)
ls.start()
except SolidLSPException as e:
log.error(f'F# LS init failed: {e}') # inspect underlying Exception via e.__cause__ Prevention
- Verify `dotnet build` succeeds on the target project before starting the LS
- Keep fsautocomplete updated to a version matching your .NET SDK
- Allow generous startup timeout on first run (NuGet restore + JIT)
- Check fsautocomplete can start standalone before integrating
When it happens
Trigger: Calling _start_server for an F# project when the fsautocomplete process crashes during startup, the initialize request times out, or the server writes an invalid JSON-RPC response.
Common situations: Broken .NET/F# toolchain installation, incompatible fsautocomplete version, corrupted project files (fsproj) that crash the compiler service on startup, or resource exhaustion killing the server process mid-initialize.
Related errors
- Unhandled document change kind: {change}; Please report to S
- Failed to start {len(exceptions)} language server(s): {failu
- The language server manager is not initialized, indicating a
- Language server is missing required capabilities: {', '.join
- Failed to start F# language server: {e}
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/e8af0e1b739013d6.
Report an issue: GitHub.