dotnet/runtime · error · RuntimeError

Invalid OS for x64.

Error message

Invalid OS for x64.

What it means

Raised by determine_benchmark_machine in superpmi_aspnet.py when arch=='x64' and host_os is neither 'windows' nor 'linux'. The crank benchmark machine name only exists for those two x64 OSes.

Source

Thrown at src/coreclr/scripts/superpmi_aspnet.py:106

#
def determine_benchmark_machine(coreclr_args):
    """ Determine the name of the benchmark machine to use

    Args:
        coreclr_args (CoreclrArguments): parsed args

    Return:
        (str) : name of the benchmnark machine
    """

    if coreclr_args.arch == "x64":
        if coreclr_args.host_os == "windows":
            return "aspnet-perf-win"
#            return "aspnet-citrine-win"
        elif coreclr_args.host_os == "linux":
            return "aspnet-perf-lin"
        else:
            raise RuntimeError("Invalid OS for x64.")
    elif coreclr_args.arch == "arm64":
        if coreclr_args.host_os == "linux":
            return "aspnet-citrine-arm"
        else:
            raise RuntimeError("Invalid OS for arm64.")
    else:
        raise RuntimeError("Invalid arch.")

def build_and_run(coreclr_args):
    """Run perf scenarios under crank and collect data with SPMI"

    Args:
        coreclr_args (CoreClrArguments): Arguments use to drive
        output_mch_name (string): Name of output mch file name
    """
    source_directory = coreclr_args.source_directory
    target_arch = coreclr_args.arch
    target_os = coreclr_args.host_os

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Check the pipeline's TargetOS/Architecture combination is one of (x64,windows) or (x64,linux).
  2. If you need osx x64 perf, use a different benchmarks harness (not superpmi_aspnet).
  3. Correct the --arch / --host_os arguments.

Example fix

// before
# --arch x64 --host_os osx -> raises [188]
// after
# osx x64 not supported here; use linux/windows, or arm64+linux
Defensive patterns

Strategy: validation

Validate before calling

if coreclr_args.arch == 'x64' and coreclr_args.host_os not in ('windows','linux'):
    raise SystemExit(f'x64 benchmarks only support windows/linux, got {coreclr_args.host_os}')

Type guard

def x64_os_supported(arch: str, host_os: str) -> bool:
    return arch != 'x64' or host_os in ('windows','linux')

Try / catch

try:
    determine_benchmark_machine(coreclr_args)
except RuntimeError as e:
    if 'Invalid OS for x64' in str(e):
        raise SystemExit('set --host_os to windows or linux for x64 benchmarks')

Prevention

When it happens

Trigger: coreclr_args.arch=='x64' with host_os in {'osx','freebsd',...} — no aspnet-perf machine is provisioned for that combo.

Common situations: Pipeline set TargetOS=osx with Architecture=x64; accidental osx default on a Mac dev box; mistyped OS in YAML.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/3dddf15f7f2bf71c. Report an issue: GitHub.