dotnet/runtime · error · RuntimeError

Unknown OS.

Error message

Unknown OS.

What it means

Raised by determine_superpmi_tool_name when coreclr_args.host_os is none of osx, linux, or windows. SuperPMI ships as 'superpmi' on Unix and 'superpmi.exe' on Windows; for any other host_os there is no published binary name, so name resolution fails before any filesystem search.

Solutions

  1. Run SuperPMI on a supported host OS (Windows, Linux, or macOS).
  2. Verify and override the detected OS with --host_os windows|linux|osx if you are actually running on one of those.
  3. If you need SuperPMI on a new OS, build the superpmi native tool for that platform upstream.

Example fix

// before
if coreclr_args.host_os == "osx" or coreclr_args.host_os == "linux":
    return "superpmi"
elif coreclr_args.host_os == "windows":
    return "superpmi.exe"
else:
    raise RuntimeError("Unknown OS.")
// after (fix invocation)
python superpmi.py <mode> --host_os linux ...
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {'osx', 'linux', 'windows'}
def validate_host_os_for_superpmi(host_os):
    if host_os not in SUPPORTED:
        raise RuntimeError(f"superpmi tool only ships for {sorted(SUPPORTED)}; got '{host_os}'. Run on a supported host OS or pass --host_os.")

Type guard

def is_superpmi_supported_os(host_os: str) -> bool:
    return isinstance(host_os, str) and host_os in {'osx', 'linux', 'windows'}

Prevention

When it happens

Trigger: Called via determine_superpmi_tool_path during startup of most SuperPMI modes; the host_os branch chain (osx/linux -> 'superpmi', windows -> 'superpmi.exe', else -> raise). Triggered when host_os is a non-desktop value such as freebsd/browser/wasi/android or an unrecognized/misspelled string.

Common situations: Running on an unsupported host OS; auto-detection picked a tier-2 OS (e.g. freebsd, illumos); an explicit --host_os override with an unsupported value; cross-target scenarios where host_os leaked from target_os.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/7f43e02fe2bfb42a. Report an issue: GitHub.

Appendix: source

Thrown at src/coreclr/scripts/superpmi.py:3902

    return None


def determine_superpmi_tool_name(coreclr_args):
    """ Determine the superpmi tool name based on the OS

    Args:
        coreclr_args (CoreclrArguments): parsed args

    Return:
        (str) Name of the superpmi tool to use
    """

    if coreclr_args.host_os == "osx" or coreclr_args.host_os == "linux":
        return "superpmi"
    elif coreclr_args.host_os == "windows":
        return "superpmi.exe"
    else:
        raise RuntimeError("Unknown OS.")


def determine_superpmi_tool_path(coreclr_args):
    """ Determine the superpmi tool full path

    Args:
        coreclr_args (CoreclrArguments): parsed args

    Return:
        (str) Path of the superpmi tool to use
    """

    superpmi_tool_name = determine_superpmi_tool_name(coreclr_args)
    return find_tool(coreclr_args, superpmi_tool_name)


def determine_mcs_tool_name(coreclr_args):
    """ Determine the mcs tool name based on the OS

View on GitHub (pinned to 60108ba66e)