dotnet/runtime · error · RuntimeError

Unknown host os: {}

Error message

Unknown host os: {}

What it means

Raised in `determine_coredistools` (superpmi.py:3759-3760) when host_os is not one of osx/linux/windows. coredistools is only shipped/built for those three OSes (libcoredistools.dylib/so/coredistools.dll), so any other host_os value is unsupported and the function refuses to guess a filename.

Source

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

    Args:
        coreclr_args (CoreclrArguments) : parsed args

    Returns:
        coredistools_location (str)     : path of [lib]coredistools.dylib|so|dll
    """

    if not hasattr(coreclr_args, "core_root") or coreclr_args.core_root is None:
        raise RuntimeError("Core_Root not set properly")

    coredistools_dll_name = None
    if coreclr_args.host_os.lower() == "osx":
        coredistools_dll_name = "libcoredistools.dylib"
    elif coreclr_args.host_os.lower() == "linux":
        coredistools_dll_name = "libcoredistools.so"
    elif coreclr_args.host_os.lower() == "windows":
        coredistools_dll_name = "coredistools.dll"
    else:
        raise RuntimeError("Unknown host os: {}".format(coreclr_args.host_os))

    coredistools_location = os.path.join(coreclr_args.core_root, coredistools_dll_name)
    if os.path.isfile(coredistools_location):
        logging.info("Using coredistools found at %s", coredistools_location)
    else:
        coredistools_r2rdump_location = os.path.join(coreclr_args.core_root, "R2RDump", coredistools_dll_name)
        if os.path.isfile(coredistools_r2rdump_location):
            logging.info("Using coredistools found at %s (copying to %s)", coredistools_r2rdump_location, coredistools_location)
            logging.debug("Copying %s -> %s", coredistools_r2rdump_location, coredistools_location)
            shutil.copy2(coredistools_r2rdump_location, coredistools_location)
        else:
            # Often, Core_Root will already exist. However, you can do a product build without
            # creating a Core_Root, and successfully run replay or asm diffs, if we just create Core_Root
            # and copy coredistools there. Note that our replays all depend on Core_Root existing, as we
            # set the current directory to Core_Root before running superpmi.
            if not os.path.isdir(coreclr_args.core_root):
                logging.warning("Warning: Core_Root does not exist at \"%s\"; creating it now", coreclr_args.core_root)
                os.makedirs(coreclr_args.core_root)

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Run asm diffs on a supported host OS (linux, osx, or windows) where coredistools is available.
  2. Do not force host_os to an unsupported value when you need asm diffs; leave it to auto-detection.
  3. If you need diffs for a cross-target, collect on the supported host and replay/diff there.
Defensive patterns

Strategy: validation

Validate before calling

supported = {'osx', 'linux', 'windows'}
if coreclr_args.host_os.lower() not in supported:
    raise SystemExit(f'coredistools only available on {sorted(supported)}; got {coreclr_args.host_os}')

Prevention

When it happens

Trigger: coreclr_args.host_os is set (explicitly or via deduction) to something like freebsd, illumos, solaris, haiku, browser, android, or wasi, and an asm-diff path triggers determine_coredistools. The OS switch in the function has no case for it.

Common situations: Cross-OS scenarios where target/host OS is a non-mainstream platform; an explicit `-target_os`/host override that leaks a value coredistools cannot satisfy; running on FreeBSD/Solaris where coredistools is not packaged.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/75e63171dac0a8a7. Report an issue: GitHub.