oraios/serena · error · SolidLSPException

No SLN file found in repository

Error message

No SLN file found in repository

What it means

Raised by OmniSharp's __init__ when find_least_depth_sln_file() finds no *.sln file in the repository root tree. OmniSharp needs a Visual Studio solution file to initialize a C# workspace, so the server refuses to start without one.

Source

Thrown at src/solidlsp/language_servers/omnisharp.py:83

class OmniSharp(SolidLanguageServer):
    """
    Provides C# specific instantiation of the LanguageServer class. Contains various configurations and settings specific to C#.

    You can pass the following entries in ``ls_specific_settings["csharp_omnisharp"]``:
        - omnisharp_version: Override the pinned OmniSharp version downloaded by Serena.
        - razor_omnisharp_version: Override the pinned Razor plugin version downloaded by Serena.
    """

    def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):
        """
        Creates an OmniSharp instance. This class is not meant to be instantiated directly. Use LanguageServer.create() instead.
        """
        omnisharp_executable_path, dll_path = self._setup_runtime_dependencies(config, solidlsp_settings)

        slnfilename = find_least_depth_sln_file(repository_root_path)
        if slnfilename is None:
            log.error("No *.sln file found in repository")
            raise SolidLSPException("No SLN file found in repository")

        cmd = " ".join(
            [
                omnisharp_executable_path,
                "-lsp",
                "--encoding",
                "ascii",
                "-z",
                "-s",
                f'"{slnfilename}"',
                "--hostPID",
                str(os.getpid()),
                "DotNet:enablePackageRestore=false",
                "--loglevel",
                "trace",
                "--plugin",
                dll_path,
                "FileOptions:SystemExcludeSearchPatterns:0=**/.git",

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Create a solution in the repo root: `dotnet new sln` then `dotnet sln add <Project>.csproj`.
  2. If a .sln exists elsewhere, ensure repository_root_path passed to the server contains it (point the server at the directory holding the sln).
  3. Add the existing solution: `dotnet sln add path/to/Existing.sln` won't merge — instead commit the sln or nest the project under the repo directory containing it.
  4. Verify with `find . -name '*.sln'` that at least one solution file is present before initializing.

Example fix

// before (shell, project without solution)
cd repo && python -m app  # No SLN file found
// after
cd repo
dotnet new sln -n MyRepo
dotnet sln add src/MyApp/MyApp.csproj
python -m app
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
def has_sln(repo_root):
    return any(Path(repo_root).rglob("*.sln"))

Prevention

When it happens

Trigger: Instantiating the OmniSharp-based C# SolidLSP server against a repository that contains no .sln file at any depth under repository_root_path.

Common situations: SDK-style projects using only .csproj files without a solution; dotnet new console projects with no sln; repo where the .sln lives outside repository_root_path; solutions stored with non-standard extension or generated at build time.

Related errors


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