dotnet/runtime · error · RuntimeError

Invalid arch.

Error message

Invalid arch.

What it means

Raised by determine_benchmark_machine() at src/coreclr/scripts/superpmi_aspnet.py:113 when arch is neither 'x64' nor 'arm64'. setup_args() already whitelists arch to x64/arm64, so this is a defensive guard reached only if that validation is bypassed by a direct call.

Solutions

  1. Pass -arch as x64 or arm64.
  2. If calling determine_benchmark_machine() directly, validate arch beforehand.
Defensive patterns

Strategy: validation

Validate before calling

if coreclr_args.arch.lower() not in ('x64', 'arm64'):
    raise SystemExit('arch must be x64 or arm64')

Type guard

def is_supported_arch(arch: str) -> bool:
    return arch.lower() in ('x64', 'arm64')

Prevention

When it happens

Trigger: Calling determine_benchmark_machine() directly (not via setup_args) with an arch like 'x86' or 'arm', or after a future arch addition that updates setup_args but not this function.

Common situations: Programmatic use of the function skipping setup_args validation.

Related errors


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

Appendix: 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 60108ba66e)