{"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/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/jitutil.py#L497-L533","documentation":"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.","triggerScenarios":"Calling determine_jit_name with host_os set to any value other than osx/linux/windows (None, 'mac', 'win', 'freebsd', etc.).","commonSituations":"platform.system() mapping producing an unexpected string; caller passing a capitalized OS; script run on an unsupported host OS without overriding host_os.","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."],"exampleFix":"// before\nname = determine_jit_name(host_os='darwin')  # 'Unknown host OS.'\n// after\nhost_os = {'darwin':'osx','win32':'windows','linux':'linux'}.get(platform.system().lower(),'linux')\nname = determine_jit_name(host_os=host_os)","handlingStrategy":"validation","validationCode":"VALID_HOST_OS = {\"osx\", \"linux\", \"windows\"}\nif host_os not in VALID_HOST_OS:\n    raise SystemExit(f\"host_os must be one of {sorted(VALID_HOST_OS)}, got {host_os!r}\")","typeGuard":"def is_supported_host_os(s: str) -> bool:\n    return s in {\"osx\", \"linux\", \"windows\"}","tryCatchPattern":null,"preventionTips":["Map platform.system() to the canonical lowercase form (darwin->osx) before calling.","Centralize OS detection so all scripts share one normalization helper."],"tags":["jitutil","os-detection","argument-validation","python"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}