rust-lang/rust · error · Exception

Unrecognized target triple {triple}

Error message

Unrecognized target triple {triple}

What it means

Raised by TestEnvironment.triple_to_arch() in fuchsia-test-runner.py at line 143. This static method maps a Rust target triple to a Fuchsia architecture name: 'x86_64' substrings map to 'x64', 'aarch64' substrings map to 'arm64'. Any other triple string raises an Exception because the Fuchsia emulator and product bundle selection only support these two architectures. The triple comes from the required --target argument (line 1192-1196).

Source

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

    @staticmethod
    def tmp_dir() -> Path:
        if TestEnvironment.__tmp_dir:
            return TestEnvironment.__tmp_dir
        tmp_dir = os.environ.get("TEST_TOOLCHAIN_TMP_DIR")
        if tmp_dir is not None:
            TestEnvironment.__tmp_dir = Path(tmp_dir).absolute()
        else:
            TestEnvironment.__tmp_dir = Path(__file__).parent.joinpath("tmp~")
        return TestEnvironment.__tmp_dir

    @staticmethod
    def triple_to_arch(triple) -> str:
        if "x86_64" in triple:
            return "x64"
        elif "aarch64" in triple:
            return "arm64"
        else:
            raise Exception(f"Unrecognized target triple {triple}")

    @classmethod
    def env_file_path(cls) -> Path:
        return cls.tmp_dir().joinpath("test_env.json")

    @classmethod
    def from_args(cls, args):
        local_pb_path = args.local_product_bundle_path
        if local_pb_path is not None:
            local_pb_path = Path(local_pb_path).absolute()

        return cls(
            rust_build_dir=Path(args.rust_build).absolute(),
            sdk_dir=Path(args.sdk).absolute(),
            target=args.target,
            toolchain_dir=Path(args.toolchain_dir).absolute(),
            local_pb_path=local_pb_path,
            use_local_pb=args.use_local_product_bundle_if_exists,

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Ensure --target is one of the two supported Fuchsia triples: 'x86_64-unknown-fuchsia' or 'aarch64-unknown-fuchsia'.
  2. Check the CI script or Makefile that invokes fuchsia-test-runner.py for the correct --target value.
  3. If you genuinely need a new architecture, extend triple_to_arch() with the mapping and ensure Fuchsia product bundles exist for it.

Example fix

# before
python3 fuchsia-test-runner.py start --target x86_64-unknown-linux-gnu ...
# after
python3 fuchsia-test-runner.py start --target x86_64-unknown-fuchsia ...
Defensive patterns

Strategy: validation

Validate before calling

# Before passing a triple to the test runner, validate it
SUPPORTED_TRIPLES = {'x86_64-unknown-fuchsia', 'aarch64-unknown-fuchsia'}

def validate_fuchsia_triple(triple):
    if 'x86_64' not in triple and 'aarch64' not in triple:
        raise ValueError(
            f'Unsupported triple: {triple}. '
            f'Use one of: {SUPPORTED_TRIPLES}'
        )
    return 'x64' if 'x86_64' in triple else 'arm64'

Try / catch

try:
    arch = TestEnvironment.triple_to_arch(target_triple)
except Exception as e:
    if 'Unrecognized target triple' in str(e):
        print(f'Use x86_64-unknown-fuchsia or aarch64-unknown-fuchsia.')
    raise

Prevention

When it happens

Trigger: triple_to_arch(self.target) is called at line 501 (for product_name: 'minimal.' + arch) and line 795 (target_arch parameter). If self.target (from args.target) contains neither 'x86_64' nor 'aarch64', the else branch at line 142-143 raises. The --target argument is required and validated only by argparse as present, not by value.

Common situations: Passing a Fuchsia-incompatible target triple to the test runner (e.g. 'x86_64-unknown-linux-gnu' instead of 'x86_64-unknown-fuchsia'); a typo in the triple; using a RISC-V or other unsupported architecture triple; or a pipeline/ci script passing the host triple instead of the Fuchsia target triple.

Related errors


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