dotnet/runtime · error · RuntimeError
Unknown host OS.
Error message
Unknown host OS.
What it means
Thrown by determine_jit_name() in jitutil.py when host_os is not 'osx', 'linux', or 'windows'. The host OS determines the file extension of the JIT binary (.dylib for macOS, .so for Linux, .dll for Windows). An unrecognized host OS means the function cannot produce a valid JIT filename.
Source
Thrown at src/coreclr/scripts/jitutil.py:515
elif target_arch.startswith("wasm"):
jit_os_name = "universal"
elif target_os == "windows":
jit_os_name = "win"
elif target_os == "osx" or target_os == "linux":
jit_os_name = "unix"
else:
raise RuntimeError("Unknown target OS.")
jit_base_name = 'clrjit_{}_{}_{}'.format(jit_os_name, target_arch, host_arch)
if host_os == "osx":
return "lib" + jit_base_name + ".dylib"
elif host_os == "linux":
return "lib" + jit_base_name + ".so"
elif host_os == "windows":
return jit_base_name + ".dll"
else:
raise RuntimeError("Unknown host OS.")
def get_deepest_existing_directory(path):
""" Given a path, find the deepest existing directory containing it. This
might be the path itself, or a parent directory. If no such directory
is found, None is returned.
Args:
path (str) : path to check
Returns:
As described above
"""
path = os.path.abspath(path)
lastPath = ""
# When os.path.dirname() is called on the root directory ("C:\\" on Windows or "/" on Linux),
# if returns itself.View on GitHub (pinned to 290d5ab72c)
Solutions
- Check -host_os and ensure it is exactly 'windows', 'linux', or 'osx'.
- Verify platform auto-detection: run 'python -c "import platform; print(platform.system().lower())"' and compare.
- If running on a genuinely new OS, add the appropriate file extension mapping in determine_jit_name().
Example fix
# before: incorrect host OS string python superpmi.py collect -host_os mac # after: correct OS name python superpmi.py collect -host_os osx
Defensive patterns
Strategy: validation
Validate before calling
# Validate host_os before calling determine_jit_name
valid_host_oses = {'osx', 'linux', 'windows'}
if host_os not in valid_host_oses:
raise ValueError(f'Unknown host OS: {host_os}. Must be one of: {valid_host_oses}') Type guard
def is_supported_host_os(host_os: str) -> bool:
return host_os in {'osx', 'linux', 'windows'} Try / catch
try:
jit_name = determine_jit_name(host_os)
except RuntimeError as e:
if 'Unknown host OS' in str(e):
logging.error('host_os must be windows, linux, or osx')
sys.exit(1)
raise Prevention
- Use exactly 'windows', 'linux', or 'osx' for the host_os parameter.
- Let the script auto-detect the host OS when possible.
- Avoid abbreviations like 'mac', 'win', or 'unix'.
When it happens
Trigger: At lines 508-515: after resolving jit_base_name (either default 'clrjit' or a cross-compile name), the function checks host_os to append the correct extension. If host_os is not 'osx', 'linux', or 'windows', line 515 raises.
Common situations: Running on an unsupported operating system (e.g., FreeBSD, Solaris, AIX) where the .NET JIT infrastructure scripts haven't been adapted. The host_os auto-detection returned an unusual platform string. A typo in a manually-specified -host_os argument.
Related errors
- Unknown target OS.
- Unknown OS.
- Unsupported OS.
- event.eventName is a required parameter, in event: ${JSON.st
- "arguments" should be an array, but was ${request.arguments}
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/ab459cc7ac8ccd82.
Report an issue: GitHub.