rust-lang/rust · critical · Exception

Unrecognized host architecture {machine}

Error message

Unrecognized host architecture {machine}

What it means

Raised by TestEnvironment.sdk_arch() when platform.machine() returns a value other than 'x86_64' or 'arm'. sdk_arch() maps the host machine to the SDK's arch subdirectory name ('x64' / 'a64'), which is used to locate ffx and other SDK host tools. An unrecognized machine means the SDK layout for that host is unknown.

Source

Thrown at src/ci/docker/scripts/fuchsia-test-runner.py:335

            "host",
            "stage2",
            "lib",
        )

    def rustlibs_dir(self) -> Path:
        return self.libs_dir().joinpath(
            "rustlib",
            self.target,
            "lib",
        )

    def sdk_arch(self):
        machine = platform.machine()
        if machine == "x86_64":
            return "x64"
        if machine == "arm":
            return "a64"
        raise Exception(f"Unrecognized host architecture {machine}")

    def tool_path(self, tool) -> Path:
        return Path(self.sdk_dir).joinpath("tools", self.sdk_arch(), tool)

    def host_arch_triple(self):
        machine = platform.machine()
        if machine == "x86_64":
            return "x86_64-unknown-linux-gnu"
        if machine == "arm":
            return "aarch64-unknown-linux-gnu"
        raise Exception(f"Unrecognized host architecture {machine}")

    def zxdb_script_path(self) -> Path:
        return Path(self.tmp_dir(), "zxdb_script")

    @property
    def ffx_daemon_log_path(self):
        return self.tmp_dir().joinpath("ffx_daemon_log")

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Run the script on x86_64 or on a 32-bit arm host (the two currently mapped values).
  2. Patch sdk_arch() to also map 'aarch64' -> 'a64' (and/or 'arm64') if your SDK ships those host tools.
  3. Cross-check the SDK's tools/ directory to see which arch subdirs actually exist and add the matching branch.
  4. If emulated, set the platform via an environment that reports x86_64 or run under an x86_64 container.

Example fix

// before (fuchsia-test-runner.py:329)
    def sdk_arch(self):
        machine = platform.machine()
        if machine == "x86_64":
            return "x64"
        if machine == "arm":
            return "a64"
        raise Exception(f"Unrecognized host architecture {machine}")

// after
    def sdk_arch(self):
        machine = platform.machine()
        if machine in ("x86_64", "amd64"):
            return "x64"
        if machine in ("arm", "aarch64", "arm64"):
            return "a64"
        raise Exception(f"Unrecognized host architecture {machine}")
Defensive patterns

Strategy: validation

Validate before calling

import platform
SUPPORTED_SDK_ARCH = {"x86_64": "x64", "arm": "a64"}

machine = platform.machine()
if machine not in SUPPORTED_SDK_ARCH:
    raise SystemExit(
        f"Host {machine!r} unsupported; supported: {sorted(SUPPORTED_SDK_ARCH)}. "
        "Run on x86_64/arm or extend sdk_arch()."
    )
# safe to call sdk_arch()
env.sdk_arch()

Type guard

def is_supported_sdk_host(machine: str) -> bool:
    return machine in ("x86_64", "arm")

Try / catch

try:
    arch = env.sdk_arch()
except Exception as e:
    if "Unrecognized host architecture" in str(e):
        sys.exit(f"Run on x86_64 or arm; this host is unsupported by the Fuchsia SDK layout.")
    raise

Prevention

When it happens

Trigger: Any call path that resolves an SDK host tool path (tool_path at line 337, used pervasively) on a machine where platform.machine() returns e.g. 'aarch64', 'arm64', 'riscv64', or 'ppc64le'.

Common situations: Running on Apple Silicon or native aarch64 Linux where platform.machine() returns 'aarch64' (not 'arm'); running under QEMU emulation that reports an unexpected machine string; running on RISC-V or other unsupported hosts.

Related errors


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/b16aa0e0414028be. Report an issue: GitHub.