{"record":{"id":"75e63171dac0a8a7","repo":"dotnet/runtime","slug":"unknown-host-os-75e631","errorCode":null,"errorMessage":"Unknown host os: {}","messagePattern":"Unknown host os: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi.py","lineNumber":3760,"sourceCode":"    Args:\n        coreclr_args (CoreclrArguments) : parsed args\n\n    Returns:\n        coredistools_location (str)     : path of [lib]coredistools.dylib|so|dll\n    \"\"\"\n\n    if not hasattr(coreclr_args, \"core_root\") or coreclr_args.core_root is None:\n        raise RuntimeError(\"Core_Root not set properly\")\n\n    coredistools_dll_name = None\n    if coreclr_args.host_os.lower() == \"osx\":\n        coredistools_dll_name = \"libcoredistools.dylib\"\n    elif coreclr_args.host_os.lower() == \"linux\":\n        coredistools_dll_name = \"libcoredistools.so\"\n    elif coreclr_args.host_os.lower() == \"windows\":\n        coredistools_dll_name = \"coredistools.dll\"\n    else:\n        raise RuntimeError(\"Unknown host os: {}\".format(coreclr_args.host_os))\n\n    coredistools_location = os.path.join(coreclr_args.core_root, coredistools_dll_name)\n    if os.path.isfile(coredistools_location):\n        logging.info(\"Using coredistools found at %s\", coredistools_location)\n    else:\n        coredistools_r2rdump_location = os.path.join(coreclr_args.core_root, \"R2RDump\", coredistools_dll_name)\n        if os.path.isfile(coredistools_r2rdump_location):\n            logging.info(\"Using coredistools found at %s (copying to %s)\", coredistools_r2rdump_location, coredistools_location)\n            logging.debug(\"Copying %s -> %s\", coredistools_r2rdump_location, coredistools_location)\n            shutil.copy2(coredistools_r2rdump_location, coredistools_location)\n        else:\n            # Often, Core_Root will already exist. However, you can do a product build without\n            # creating a Core_Root, and successfully run replay or asm diffs, if we just create Core_Root\n            # and copy coredistools there. Note that our replays all depend on Core_Root existing, as we\n            # set the current directory to Core_Root before running superpmi.\n            if not os.path.isdir(coreclr_args.core_root):\n                logging.warning(\"Warning: Core_Root does not exist at \\\"%s\\\"; creating it now\", coreclr_args.core_root)\n                os.makedirs(coreclr_args.core_root)","sourceCodeStart":3742,"sourceCodeEnd":3778,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/superpmi.py#L3742-L3778","documentation":"Raised by determine_coredistools when coreclr_args.host_os is none of osx/linux/windows. Although CoreclrArguments.valid_host_os includes additional platforms (illumos, solaris, haiku, freebsd, browser, android, wasi), the coredistools native library only ships for the three desktop/server OSes, so the loader name cannot be chosen and the function aborts.","triggerScenarios":"Called whenever asm diffs need coredistools on an unsupported host_os. Triggered if the host_os was auto-detected or passed as one of the non-desktop values (e.g. 'freebsd', 'browser', 'wasi', 'android'), or if a custom/misspelled OS string reaches this point.","commonSituations":"Cross-targeting or building for browser/wasi/android and running superpmi.py asmdiff on that same host_os; an incorrect --host_os argument; running on FreeBSD/Solaris/Haiku where coredistools is not published.","solutions":["Run SuperPMI asm diffs on a supported host OS (Windows, Linux, or macOS) and use cross-compile target flags for the other platform.","Check the detected/override host_os value and pass --host_os windows|linux|osx if you are actually on one of those.","If you genuinely need coredistools on a new OS, you must build libcoredistools for that platform and contribute support upstream."],"exampleFix":"// before\nif coreclr_args.host_os.lower() == \"osx\":\n    ...\nelif coreclr_args.host_os.lower() == \"linux\":\n    ...\nelif coreclr_args.host_os.lower() == \"windows\":\n    ...\nelse:\n    raise RuntimeError(\"Unknown host os: {}\".format(coreclr_args.host_os))\n// after (no code change; fix invocation)\n# Pass an explicit supported host_os:\npython superpmi.py asmdiff --host_os linux ...","handlingStrategy":"validation","validationCode":"SUPPORTED_HOST_OS_FOR_COREDISTOOLS = {'windows', 'linux', 'osx'}\ndef validate_host_os_for_coredistools(host_os):\n    if host_os is None:\n        raise RuntimeError('host_os is None; pass --host_os')\n    if host_os.lower() not in SUPPORTED_HOST_OS_FOR_COREDISTOOLS:\n        raise RuntimeError(f\"coredistools only supports {sorted(SUPPORTED_HOST_OS_FOR_COREDISTOOLS)}; got '{host_os}'. Run asmdiff on a supported host OS.\")","typeGuard":"def is_coredistools_supported_os(host_os: str) -> bool:\n    return isinstance(host_os, str) and host_os.lower() in {'windows', 'linux', 'osx'}","tryCatchPattern":null,"preventionTips":["Run asm diffs only on Windows, Linux, or macOS.","Pass --host_os explicitly to avoid mis-detection on tier-2 platforms.","For cross-target scenarios, run on a supported host and use target flags."],"tags":["host-os","coredistools","platform","superpmi","asmdiff"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}