dotnet/runtime · error · RuntimeError
Unknown host OS.
Error message
Unknown host OS.
What it means
Raised by determine_jit_name() in jitutil.py at the final return when host_os is not 'osx', 'linux', or 'windows'. This is the host-side OS check used to pick the JIT file extension (.dylib/.so/.dll) and prefix.
Solutions
- Pass host_os as exactly one of: osx, linux, windows.
- Detect and normalize the host OS before calling (map 'darwin'->'osx', 'win32'->'windows').
- Extend the function if you genuinely need to support another host OS.
Example fix
// before
name = determine_jit_name(host_os='darwin') # 'Unknown host OS.'
// after
host_os = {'darwin':'osx','win32':'windows','linux':'linux'}.get(platform.system().lower(),'linux')
name = determine_jit_name(host_os=host_os) Defensive patterns
Strategy: validation
Validate before calling
VALID_HOST_OS = {"osx", "linux", "windows"}
if host_os not in VALID_HOST_OS:
raise SystemExit(f"host_os must be one of {sorted(VALID_HOST_OS)}, got {host_os!r}") Type guard
def is_supported_host_os(s: str) -> bool:
return s in {"osx", "linux", "windows"} Prevention
- Map platform.system() to the canonical lowercase form (darwin->osx) before calling.
- Centralize OS detection so all scripts share one normalization helper.
When it happens
Trigger: Calling determine_jit_name with host_os set to any value other than osx/linux/windows (None, 'mac', 'win', 'freebsd', etc.).
Common situations: platform.system() mapping producing an unexpected string; caller passing a capitalized OS; script run on an unsupported host OS without overriding host_os.
Related errors
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/ab459cc7ac8ccd82.
Report an issue: GitHub.
Appendix: 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 60108ba66e)