oraios/serena · error · SolidLSPException

Failed to start F# language server: {e}

Error message

Failed to start F# language server: {e}

What it means

When the underlying LSP process wrapper (self.server.start()) fails to launch the FsAutoComplete process, _start_server logs the cause and re-raises it as SolidLSPException. This typically means the command line, working directory, or environment made the server process die immediately at startup.

Source

Thrown at src/solidlsp/language_servers/fsharp_language_server.py:412

            """Handle window/workDoneProgress/create requests from the LSP server."""
            # Just acknowledge the request - we don't need to track progress for now
            return

        # Register custom handlers
        self.server.on_notification("window/logMessage", handle_window_log_message)
        self.server.on_notification("window/showMessage", handle_window_show_message)
        self.server.on_request("workspace/configuration", handle_workspace_configuration)
        self.server.on_request("client/registerCapability", handle_client_register_capability)
        self.server.on_request("client/unregisterCapability", handle_client_unregister_capability)
        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:

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Run fsautocomplete manually with the same flags to see the crash: fsautocomplete --adaptive-lsp-server-enabled --project-graph-enabled --use-fcs-transparent-compiler
  2. Verify the .NET runtime works: dotnet --info, and reinstall FsAutoComplete if broken
  3. Check that the repository_root_path (cwd) exists and is readable by the process
  4. Read the preceding log.error line ('Failed to start F# language server process: ...') for the root cause and fix that underlying exception

Example fix

// before
$ fsautocomplete --adaptive-lsp-server-enabled   # fails: dotnet runtime missing
// after
$ dotnet --info        # verify runtime
$ dotnet tool update --global fsautocomplete
$ fsautocomplete --adaptive-lsp-server-enabled   # starts OK; then restart Serena
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil, subprocess
def fsautocomplete_launchable() -> bool:
    exe = shutil.which("fsautocomplete")
    if not exe:
        return False
    r = subprocess.run([exe, "--help"], capture_output=True, timeout=10)
    return r.returncode == 0

Type guard

def server_process_can_start(cmd: list[str], cwd: str) -> bool:
    import os, shutil
    return bool(cwd and os.path.isdir(cwd)) and shutil.which(cmd[0]) is not None

Try / catch

try:
    server = LanguageServer.create(LanguageServerId.FSHARP, ...)
except SolidLSPException as e:
    logger.error("F# LS failed to start: %s", e)
    # check underlying cause: dotnet runtime, cwd, binary permissions

Prevention

When it happens

Trigger: Calling _start_server where self.server.start() throws — fsautocomplete binary not executable/found at launch time, missing dotnet runtime when executing the wrapper script, bad cwd, or an exception raised while spawning the process.

Common situations: FsAutoComplete crashed on startup due to a missing/broken .NET runtime; binary installed but PATH/cwd invalid at runtime; port/resource conflicts or permissions preventing process spawn.

Related errors


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