dotnet/runtime · error · RuntimeError

Unknown OS.

Error message

Unknown OS.

What it means

Raised by upload_command in jitrollingbuild.py when computing the set of allowed cross-JIT file extensions. The if/elif chain only handles host_os == 'osx', 'linux', and 'windows'; any other value falls to the else branch and raises 'Unknown OS.' This guards the cross-compilation JIT enumeration step of the upload.

Solutions

  1. Pass -host_os as one of the exact lowercase values: windows, osx, or linux.
  2. Omit -host_os entirely so it defaults to the detected current OS.
  3. If you genuinely need another OS, the script must be extended to handle it before this branch is reached.

Example fix

// before
python jitrollingbuild.py upload -git_hash abc -host_os mac   # 'Unknown OS.'
// after
python jitrollingbuild.py upload -git_hash abc -host_os osx
Defensive patterns

Strategy: validation

Validate before calling

VALID = {"windows", "osx", "linux"}
if host_os not in VALID:
    raise SystemExit(f"-host_os must be one of {sorted(VALID)}, got {host_os!r}")

Type guard

def is_supported_upload_os(s: str) -> bool:
    return s in {"windows", "osx", "linux"}

Prevention

When it happens

Trigger: Invoking `jitrollingbuild.py upload` with -host_os set to a value other than windows/osx/linux (e.g. typo like 'mac', 'win', 'Unix', or an unsupported platform string).

Common situations: Typos in -host_os; passing a capitalized variant like 'Windows' or 'Linux' when the script expects lowercase; using a platform the rolling-build uploader was never taught.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/cdcd0698429b5aad. Report an issue: GitHub.

Appendix: source

Thrown at src/coreclr/scripts/jitrollingbuild.py:414

    # and so on, and live in the same product directory as the primary JIT.
    #
    # Note that the expression below explicitly filters out the primary JIT since we added that above.
    # We handle the primary JIT specially so we can error if it is missing. For the cross-compilation
    # JITs, we don't bother trying to ensure that all the ones we might expect are actually there.
    #
    # We don't do a recursive walk because the JIT is also copied to the "sharedFramework" subdirectory,
    # so we don't want to pick that up.

    if coreclr_args.host_os == "osx":
        allowed_extensions = [ ".dylib" ]
        # Add .dwarf for debug info
    elif coreclr_args.host_os == "linux":
        allowed_extensions = [ ".so" ]
        # Add .dbg for debug info
    elif coreclr_args.host_os == "windows":
        allowed_extensions = [ ".dll" ]
    else:
        raise RuntimeError("Unknown OS.")

    cross_jit_paths = [os.path.join(coreclr_args.product_location, item)
                       for item in os.listdir(coreclr_args.product_location)
                       if re.match(r'.*clrjit.*', item) and item != jit_name and any(item.endswith(extension) for extension in allowed_extensions)]
    files += cross_jit_paths

    # On Windows, grab the PDB files from a sub-directory.
    # if coreclr_args.host_os == "windows":
    #    pdb_dir = os.path.join(coreclr_args.product_location, "PDB")
    #    if os.path.isdir(pdb_dir):
    #        pdb_paths = [os.path.join(pdb_dir, item) for item in os.listdir(pdb_dir) if re.match(r'.*clrjit.*', item)]
    #        files += pdb_paths

    # Figure out which git hash to use for the upload. By default, it is the required coreclr_args.git_hash argument.
    # However, if "--use_latest_jit_change" is passed, we look backwards in the git log for the nearest git commit
    # with a JIT change (it could, and often will be, the same as the argument git_hash).
    jit_git_hash = coreclr_args.git_hash

View on GitHub (pinned to 60108ba66e)