dotnet/runtime · error · RuntimeError
Unknown host os
Error message
Unknown host os: {} What it means
Raised by determine_coredistools when coreclr_args.host_os is none of osx/linux/windows. Although CoreclrArguments.valid_host_os includes additional platforms (illumos, solaris, haiku, freebsd, browser, android, wasi), the coredistools native library only ships for the three desktop/server OSes, so the loader name cannot be chosen and the function aborts.
Solutions
- Run SuperPMI asm diffs on a supported host OS (Windows, Linux, or macOS) and use cross-compile target flags for the other platform.
- Check the detected/override host_os value and pass --host_os windows|linux|osx if you are actually on one of those.
- If you genuinely need coredistools on a new OS, you must build libcoredistools for that platform and contribute support upstream.
Example fix
// before
if coreclr_args.host_os.lower() == "osx":
...
elif coreclr_args.host_os.lower() == "linux":
...
elif coreclr_args.host_os.lower() == "windows":
...
else:
raise RuntimeError("Unknown host os: {}".format(coreclr_args.host_os))
// after (no code change; fix invocation)
# Pass an explicit supported host_os:
python superpmi.py asmdiff --host_os linux ... Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_HOST_OS_FOR_COREDISTOOLS = {'windows', 'linux', 'osx'}
def validate_host_os_for_coredistools(host_os):
if host_os is None:
raise RuntimeError('host_os is None; pass --host_os')
if host_os.lower() not in SUPPORTED_HOST_OS_FOR_COREDISTOOLS:
raise RuntimeError(f"coredistools only supports {sorted(SUPPORTED_HOST_OS_FOR_COREDISTOOLS)}; got '{host_os}'. Run asmdiff on a supported host OS.") Type guard
def is_coredistools_supported_os(host_os: str) -> bool:
return isinstance(host_os, str) and host_os.lower() in {'windows', 'linux', 'osx'} Prevention
- Run asm diffs only on Windows, Linux, or macOS.
- Pass --host_os explicitly to avoid mis-detection on tier-2 platforms.
- For cross-target scenarios, run on a supported host and use target flags.
When it happens
Trigger: Called whenever asm diffs need coredistools on an unsupported host_os. Triggered if the host_os was auto-detected or passed as one of the non-desktop values (e.g. 'freebsd', 'browser', 'wasi', 'android'), or if a custom/misspelled OS string reaches this point.
Common situations: Cross-targeting or building for browser/wasi/android and running superpmi.py asmdiff on that same host_os; an incorrect --host_os argument; running on FreeBSD/Solaris/Haiku where coredistools is not published.
Related errors
- Core_Root not set properly
- Unknown OS.
- Couldn't create git diff
- Couldn't determine baseline git hash
- Couldn't determine current git hash
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/75e63171dac0a8a7.
Report an issue: GitHub.
Appendix: 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 60108ba66e)