dotnet/runtime · error · RuntimeError
Unknown OS.
Error message
Unknown OS.
What it means
Raised by get_native_library_name in superpmi_aspnet.py when target_os is not one of 'osx','linux','windows'. The helper maps an OS to its native library suffix and has no default.
Source
Thrown at src/coreclr/scripts/superpmi_aspnet.py:84
def determine_native_name(coreclr_args, base_lib_name, target_os):
""" Determine the name of the native lib based on the OS.
Args:
coreclr_args (CoreclrArguments): parsed args
base_lib_name (str) : root name of the lib
target_os (str) : os to run tests on
Return:
(str) : name of the native lib for this OS
"""
if target_os == "osx":
return "lib" + base_lib_name + ".dylib"
elif target_os == "linux":
return "lib" + base_lib_name + ".so"
elif target_os == "windows":
return base_lib_name + ".dll"
else:
raise RuntimeError("Unknown OS.")
# Where there is an option, we generally target the less performant machines
# See https://github.com/aspnet/Benchmarks/tree/master/scenarios
#
def determine_benchmark_machine(coreclr_args):
""" Determine the name of the benchmark machine to use
Args:
coreclr_args (CoreclrArguments): parsed args
Return:
(str) : name of the benchmnark machine
"""
if coreclr_args.arch == "x64":
if coreclr_args.host_os == "windows":
return "aspnet-perf-win"
# return "aspnet-citrine-win"View on GitHub (pinned to 290d5ab72c)
Solutions
- Print coreclr_args.host_os / target_os at the call site to see the actual value.
- Normalize casing: `.lower()` the os before calling, or extend the if-chain for the new OS.
- Fix the pipeline variable feeding --host_os.
- For wasm/browser flows use superpmi_aspnet2.py or the dedicated wasm path instead.
Example fix
// before # host_os='Linux' -> falls through to raise // after target_os = target_os.lower() # or extend helper to handle the new OS
Defensive patterns
Strategy: type-guard
Validate before calling
SUPPORTED = {'osx','linux','windows'}
if target_os not in SUPPORTED:
raise SystemExit(f'Unsupported OS {target_os!r}; expected one of {SUPPORTED}') Type guard
def is_supported_native_os(os: str) -> bool:
return os in {'osx','linux','windows'} Try / catch
try:
get_native_library_name(coreclr_args, base_lib_name, target_os)
except RuntimeError as e:
if 'Unknown OS' in str(e):
raise SystemExit(f'configure pipeline TargetOS; got {target_os}') Prevention
- Normalize host_os with .lower() before passing
- Extend the helper when adding a new OS
- Validate OS against a supported set early
When it happens
Trigger: coreclr_args.host_os (or a passed target_os) is e.g. 'freebsd','browser','wasm', an empty string, or a case variant the comparison doesn't accept.
Common situations: New/experimental target_os added to the build matrix without updating this helper; mismatched casing ('Linux'); typo in pipeline variable; passing target_os from a future wasm flow.
Related errors
- Invalid OS for x64.
- Invalid OS for arm64.
- Invalid arch.
- Couldn't determine current git hash
- No JIT changes found starting with baseline hash
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/5ab356f79514e121.
Report an issue: GitHub.