{"record":{"id":"69d5bd962d9836a5","repo":"dotnet/runtime","slug":"unknown-target-os","errorCode":null,"errorMessage":"Unknown target OS.","messagePattern":"Unknown target OS\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/jitutil.py","lineNumber":504,"sourceCode":"        If you pass one of target_os, host_arch, or target_arch, you must pass them all.\n\n    Return:\n        (str) : name of the jit for this OS\n    \"\"\"\n\n    jit_base_name = 'clrjit'\n\n    if use_cross_compile_jit or (host_arch != target_arch) or ((target_os is not None) and (host_os != target_os)):\n        if target_arch.startswith(\"arm\"):\n            jit_os_name = \"universal\"\n        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","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/jitutil.py#L486-L522","documentation":"Raised by determine_jit_name() in jitutil.py in the cross-compilation JIT branch. When use_cross_compile_jit is set or host/target arch differ or target OS differs from host, the function builds a cross-JIT name; if target_os is not 'windows', 'osx', or 'linux' (and target_arch is not arm*/wasm*) it raises 'Unknown target OS.'","triggerScenarios":"Calling determine_jit_name with a target_os outside {windows, osx, linux} while requesting a cross-compile JIT (e.g. target_arch differs from host_arch, or target_os passed and differs from host_os).","commonSituations":"Passing a target_os typo or an unsupported platform string; calling superpmi collect/replay with -target_os set incorrectly; mixing capitalized forms.","solutions":["Pass target_os as one of: windows, osx, linux (lowercase).","Omit -target_os if you do not need cross-OS compilation.","Verify target_arch/host_arch are consistent and that you actually need the cross-compile path."],"exampleFix":"// before\njit_name = determine_jit_name(host_os='linux', target_os='unix', host_arch='x64', target_arch='arm64')  # 'Unknown target OS.'\n// after\njit_name = determine_jit_name(host_os='linux', target_os='linux', host_arch='x64', target_arch='arm64')","handlingStrategy":"validation","validationCode":"VALID_TARGET_OS = {\"windows\", \"osx\", \"linux\"}\nif use_cross_compile_jit or (host_arch != target_arch) or (target_os is not None and host_os != target_os):\n    if not (target_arch.startswith(\"arm\") or target_arch.startswith(\"wasm\")) and target_os not in VALID_TARGET_OS:\n        raise SystemExit(f\"target_os must be one of {sorted(VALID_TARGET_OS)} for cross-compile, got {target_os!r}\")","typeGuard":"def is_supported_target_os(s: str) -> bool:\n    return s in {\"windows\", \"osx\", \"linux\"}","tryCatchPattern":null,"preventionTips":["Only pass target_os when you actually need cross-OS compilation.","Keep target_os lowercase and within the supported set."],"tags":["jitutil","cross-compile","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"}