zellij-org/zellij · error

rustc didn't output the 'host' triple

Error message

rustc didn't output the 'host' triple

What it means

host_target_triple runs `rustc -vV` and parses lines starting with 'host' via split_once(": "), expecting exactly one host triple. If no parsable host line is found, the environment's rustc did not report a host triple in the expected format and test setup aborts.

Source

Thrown at xtask/src/test.rs:110

pub fn host_target_triple(sh: &Shell) -> anyhow::Result<String> {
    let rustc_ver = cmd!(sh, "rustc -vV")
        .read()
        .context("Failed to determine host triple")?;
    let maybe_triple = rustc_ver
        .lines()
        .filter_map(|line| {
            if !line.starts_with("host") {
                return None;
            }
            if let Some((_, triple)) = line.split_once(": ") {
                Some(triple.to_string())
            } else {
                None
            }
        })
        .collect::<Vec<String>>();
    match maybe_triple.len() {
        0 => Err(anyhow!("rustc didn't output the 'host' triple")),
        1 => Ok(maybe_triple.into_iter().next().unwrap()),
        _ => Err(anyhow!(
            "rustc provided multiple host triples: {:?}",
            maybe_triple
        )),
    }
}

View on GitHub (pinned to 98a0837077)

Solutions

  1. Run `rustc -vV` yourself and confirm a `host: <triple>` line is present
  2. Unset overrides (`RUSTC`, `RUSTC_WRAPPER`) and retry
  3. Repair the toolchain: `rustup update` or reinstall the active toolchain
  4. If a wrapper is required, make it pass `rustc -vV` through unchanged

Example fix

# before: wrapper mangles rustc -vV
RUSTC_WRAPPER=./my-wrapper cargo xtask test

# after
unset RUSTC_WRAPPER
cargo xtask test
Defensive patterns

Strategy: validation

Validate before calling

# confirm rustc reports a host triple before running test tasks
rustc -vV | grep -E '^host: [^ ]+' >/dev/null || {
  echo 'rustc did not report a host triple; check RUSTC/RUSTC_WRAPPER and toolchain'; exit 1;
}

Type guard

fn parse_host_triple(rustc_vv: &str) -> Option<&str> {
    let mut hits = rustc_vv.lines().filter_map(|l| l.starts_with("host").then(|| l.split_once(": ")).flatten().map(|(_, t)| t));
    let first = hits.next()?;
    hits.next().is_none().then_some(first)
}

Try / catch

match test::host_target_triple(&sh) {
    Ok(triple) => { /* proceed */ }
    Err(e) if e.to_string().contains("rustc didn't output the 'host' triple") => {
        // diagnose toolchain: print `rustc -vV`, unset RUSTC_WRAPPER, then retry once
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A rustc shim/wrapper (RUSTC_WRAPPER, toolchain managers) that alters or drops `rustc -vV` output; a broken or partially installed toolchain; PATH resolving `rustc` to something that is not the real compiler.

Common situations: CI images with custom RUSTC env vars; unusual rustup states after partial updates; sandboxes where rustc's stderr/stdout is redirected.

Related errors


AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16). Data as JSON: /api/errors/9c20509e4ae65cc6. Report an issue: GitHub.