oraios/serena · error · SolidLSPException

dotnet not found on the system

Error message

dotnet not found on the system

What it means

Raised by get_dotnet_version when the `dotnet --list-runtimes` command succeeds but lists no Microsoft.NETCore.App runtime, meaning the dotnet CLI exists but no .NET Core runtime is installed (or the output format is unexpected).

Source

Thrown at src/solidlsp/ls_utils.py:764

        }

        return arch_map.get(sys_info.wProcessorArchitecture, f"Unknown ({sys_info.wProcessorArchitecture})")

    @staticmethod
    def get_dotnet_version() -> DotnetVersion:
        """
        Returns the dotnet version for the current system
        """
        try:
            result = subprocess_run(["dotnet", "--list-runtimes"], capture_output=True, check=True)
            available_version_cmd_output = []
            for line in result.stdout.split("\n"):
                if line.startswith("Microsoft.NETCore.App"):
                    version_cmd_output = line.split(" ")[1]
                    available_version_cmd_output.append(version_cmd_output)

            if not available_version_cmd_output:
                raise SolidLSPException("dotnet not found on the system")

            # Check for supported versions in order of preference (latest first)
            for version_cmd_output in available_version_cmd_output:
                if version_cmd_output.startswith("9"):
                    return DotnetVersion.V9
                if version_cmd_output.startswith("8"):
                    return DotnetVersion.V8
                if version_cmd_output.startswith("7"):
                    return DotnetVersion.V7
                if version_cmd_output.startswith("6"):
                    return DotnetVersion.V6
                if version_cmd_output.startswith("4"):
                    return DotnetVersion.V4

            # If no supported version found, raise exception with all available versions
            raise SolidLSPException(
                f"No supported dotnet version found. Available versions: {', '.join(available_version_cmd_output)}. Supported versions: 4, 6, 7, 8, 9"
            )

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install a .NET runtime: `dotnet --list-runtimes` should show a Microsoft.NETCore.App entry
  2. Reinstall the .NET SDK/runtime if output looks corrupted
  3. Fall back to installing mono if .NET is not desired

Example fix

// before
$ which dotnet  # exists but no runtimes
// after
$ apt install dotnet-runtime-8.0  # or download SDK from dot.net
Defensive patterns

Strategy: validation

Validate before calling

import subprocess
out = subprocess.run(["dotnet", "--list-runtimes"], capture_output=True, text=True)
runtimes = [l for l in out.stdout.splitlines() if l.startswith("Microsoft.NETCore.App")]
if not runtimes:
    raise EnvironmentError("dotnet present but no .NET runtime installed")

Type guard

def has_dotnet_runtime() -> bool:
    try:
        out = subprocess.run(["dotnet","--list-runtimes"], capture_output=True, text=True, check=True)
    except (FileNotFoundError, subprocess.CalledProcessError):
        return False
    return any(l.startswith("Microsoft.NETCore.App") for l in out.stdout.splitlines())

Try / catch

try:
    version = get_dotnet_version()
except SolidLSPException as e:
    if "dotnet not found" in str(e):
        install_dotnet_runtime()
    raise

Prevention

When it happens

Trigger: Calling get_dotnet_version (via _setup_runtime_dependencies, e.g. for the C# language server) on a machine where only the dotnet SDK binary stub exists without runtimes, or dotnet prints an unrecognized format.

Common situations: Freshly installed dotnet without any runtime; container images with SDK but stripped runtimes; corrupted dotnet installation.

Related errors


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