dotnet/runtime · error · RuntimeError

Invalid arch.

Error message

Invalid arch.

What it means

Raised by determine_benchmark_machine in superpmi_aspnet.py when coreclr_args.arch is neither 'x64' nor 'arm64'. No benchmark machine name is defined for other architectures (e.g. x86, arm, wasm).

Source

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

    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

    checked_root = path.join(source_directory, "artifacts", "bin", "coreclr", target_os + "." + coreclr_args.arch + ".Checked")
    release_root = path.join(source_directory, "artifacts", "bin", "coreclr", target_os + "." + coreclr_args.arch + ".Release")

    # We'll use repo script to install dotnet
    dotnet_install_script_name = "dotnet-install.cmd" if is_windows else "dotnet-install.sh"
    dotnet_install_script_path = path.join(source_directory, "eng", "common", dotnet_install_script_name)

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Set --arch to x64 or arm64.
  2. If you genuinely need another arch, that combination is unsupported by this script — use a different flow.
  3. Audit the pipeline's Architecture variable.

Example fix

// before
# --arch x86 -> raises [190]
// after
--arch x64   # or arm64
Defensive patterns

Strategy: type-guard

Validate before calling

if coreclr_args.arch not in ('x64','arm64'):
    raise SystemExit(f"Unsupported arch {coreclr_args.arch!r}; only x64/arm64 have benchmark machines")

Type guard

def is_benchmark_arch(arch: str) -> bool:
    return arch in ('x64','arm64')

Try / catch

try:
    determine_benchmark_machine(coreclr_args)
except RuntimeError as e:
    if 'Invalid arch' in str(e):
        raise SystemExit('set --arch to x64 or arm64')

Prevention

When it happens

Trigger: coreclr_args.arch in {'x86','arm','wasm',''} passed to the aspnet benchmark path.

Common situations: Pipeline Architecture misconfigured; x86/arm flavor accidentally routed through superpmi_aspnet.py; future arch not yet added.

Related errors


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