zellij-org/zellij · error
rustc provided multiple host triples: {:?}
Error message
rustc provided multiple host triples: {:?} What it means
Same `rustc -vV` parser, opposite failure: more than one line beginning with 'host' followed by ': ' was collected, so the host triple is ambiguous and the function refuses to guess.
Source
Thrown at xtask/src/test.rs:112
.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
- Inspect `rustc -vV` output for duplicated 'host' lines and identify who adds them
- Remove the wrapper/shim (RUSTC_WRAPPER and similar env) so plain rustc answers
- Reproduce with a clean environment: `env -i PATH="$PATH" rustc -vV`
Example fix
# before: wrapper echoes "host: ..." twice RUSTC_WRAPPER=my-echo-wrapper cargo xtask test # after unset RUSTC_WRAPPER cargo xtask test
Defensive patterns
Strategy: validation
Validate before calling
# exactly one host line may appear in rustc -vV output count=$(rustc -vV | grep -cE '^host: ' || true) if [ "$count" -ne 1 ]; then echo "expected exactly 1 host line, got $count; inspect rustc -vV and remove wrappers"; exit 1 fi
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("multiple host triples") => {
// a wrapper is duplicating output; re-run with a clean env and retry once
}
Err(e) => return Err(e),
} Prevention
- Avoid compiler wrappers that echo commands or prepend banners to rustc output
- Validate the environment with `env -i PATH="$PATH" rustc -vV` when triple parsing misbehaves
- Pin CI images to plain rustup toolchains for tasks that parse rustc -vV
When it happens
Trigger: A rustc wrapper echoing the command line or duplicating rustc's banner; environment noise prepended to rustc output; a custom rustc printing the host line twice.
Common situations: Verbose shims (sccache-style prefixes, logging wrappers) in CI; tools that `tee` compiler output; exotic toolchains that add extra host lines.
Related errors
AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16).
Data as JSON: /api/errors/8763a2bec9a9f7cb.
Report an issue: GitHub.