{"record":{"id":"ab459cc7ac8ccd82","repo":"dotnet/runtime","slug":"unknown-host-os","errorCode":null,"errorMessage":"Unknown host OS.","messagePattern":"Unknown host OS\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/jitutil.py","lineNumber":515,"sourceCode":"        elif target_arch.startswith(\"wasm\"):\n            jit_os_name = \"universal\"\n        elif target_os == \"windows\":\n            jit_os_name = \"win\"\n        elif target_os == \"osx\" or target_os == \"linux\":\n            jit_os_name = \"unix\"\n        else:\n            raise RuntimeError(\"Unknown target OS.\")\n\n        jit_base_name = 'clrjit_{}_{}_{}'.format(jit_os_name, target_arch, host_arch)\n\n    if host_os == \"osx\":\n        return \"lib\" + jit_base_name + \".dylib\"\n    elif host_os == \"linux\":\n        return \"lib\" + jit_base_name + \".so\"\n    elif host_os == \"windows\":\n        return jit_base_name + \".dll\"\n    else:\n        raise RuntimeError(\"Unknown host OS.\")\n\n\ndef get_deepest_existing_directory(path):\n    \"\"\" Given a path, find the deepest existing directory containing it. This\n        might be the path itself, or a parent directory. If no such directory\n        is found, None is returned.\n\n    Args:\n        path (str) : path to check\n\n    Returns:\n        As described above\n    \"\"\"\n    path = os.path.abspath(path)\n    lastPath = \"\"\n\n    # When os.path.dirname() is called on the root directory (\"C:\\\\\" on Windows or \"/\" on Linux),\n    # if returns itself.","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/dotnet/runtime/blob/b7130aa5e416e88ac48fafe92bf56a9d64e13c97/src/coreclr/scripts/jitutil.py#L497-L533","documentation":"Raised by determine_jit_name() in jitutil when host_os (the OS the JIT will run ON) is not 'osx', 'linux', or 'windows'. host_os selects the file extension and 'lib' prefix of the returned JIT name, so an unrecognized value leaves the function unable to produce a valid filename.","triggerScenarios":"Calling determine_jit_name(host_os=<bad>) directly, or indirectly via scripts that auto-detect host_os and pass through an unsupported value. The final else at jitutil.py:514-515 catches anything not matched above.","commonSituations":"platform.system() returning an unexpected string on a niche OS; passing a target_os into the host_os slot by mistake; casing/alias mismatch such as 'macOS' or 'win'; new host platform not yet supported by the JIT tooling.","solutions":["Pass host_os as exactly 'windows', 'linux', or 'osx'.","Map platform.system() output: Darwin->osx, Linux->linux, Windows->windows before calling.","If you genuinely need a new OS, extend determine_jit_name with the appropriate extension/prefix."],"exampleFix":"// before\njitutil.determine_jit_name(host_os='macOS')\n// after\njitutil.determine_jit_name(host_os='osx')","handlingStrategy":"type-guard","validationCode":"if host_os not in (\"osx\", \"linux\", \"windows\"):\n    raise SystemExit(\"host_os must be one of osx, linux, windows\")","typeGuard":"def is_supported_host_os(value: str) -> bool:\n    return value in (\"osx\", \"linux\", \"windows\")","tryCatchPattern":"null","preventionTips":["Map platform.system() to osx/linux/windows before calling.","Never pass target_os into the host_os slot.","Add argparse choices validation when wrapping this helper."],"tags":["os","jit","validation","configuration"],"analyzedSha":"b7130aa5e416e88ac48fafe92bf56a9d64e13c97","analyzedAt":"2026-08-07T06:17:13.108Z","schemaVersion":2},"datasetVersion":"2026-08-07T15:17:06.553Z"}