{"record":{"id":"8763a2bec9a9f7cb","repo":"zellij-org/zellij","slug":"rustc-provided-multiple-host-triples","errorCode":null,"errorMessage":"rustc provided multiple host triples: {:?}","messagePattern":"rustc provided multiple host triples: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/test.rs","lineNumber":112,"sourceCode":"        .read()\n        .context(\"Failed to determine host triple\")?;\n    let maybe_triple = rustc_ver\n        .lines()\n        .filter_map(|line| {\n            if !line.starts_with(\"host\") {\n                return None;\n            }\n            if let Some((_, triple)) = line.split_once(\": \") {\n                Some(triple.to_string())\n            } else {\n                None\n            }\n        })\n        .collect::<Vec<String>>();\n    match maybe_triple.len() {\n        0 => Err(anyhow!(\"rustc didn't output the 'host' triple\")),\n        1 => Ok(maybe_triple.into_iter().next().unwrap()),\n        _ => Err(anyhow!(\n            \"rustc provided multiple host triples: {:?}\",\n            maybe_triple\n        )),\n    }\n}\n","sourceCodeStart":94,"sourceCodeEnd":118,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/xtask/src/test.rs#L94-L118","documentation":"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.","triggerScenarios":"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.","commonSituations":"Verbose shims (sccache-style prefixes, logging wrappers) in CI; tools that `tee` compiler output; exotic toolchains that add extra host lines.","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`"],"exampleFix":"# before: wrapper echoes \"host: ...\" twice\nRUSTC_WRAPPER=my-echo-wrapper cargo xtask test\n\n# after\nunset RUSTC_WRAPPER\ncargo xtask test","handlingStrategy":"validation","validationCode":"# exactly one host line may appear in rustc -vV output\ncount=$(rustc -vV | grep -cE '^host: ' || true)\nif [ \"$count\" -ne 1 ]; then\n  echo \"expected exactly 1 host line, got $count; inspect rustc -vV and remove wrappers\"; exit 1\nfi","typeGuard":"fn parse_host_triple(rustc_vv: &str) -> Option<&str> {\n    let mut hits = rustc_vv.lines().filter_map(|l| l.starts_with(\"host\").then(|| l.split_once(\": \")).flatten().map(|(_, t)| t));\n    let first = hits.next()?;\n    hits.next().is_none().then_some(first)\n}","tryCatchPattern":"match test::host_target_triple(&sh) {\n    Ok(triple) => { /* proceed */ }\n    Err(e) if e.to_string().contains(\"multiple host triples\") => {\n        // a wrapper is duplicating output; re-run with a clean env and retry once\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["rustc","toolchain","environment","test"],"backgroundTag":null,"analyzedSha":"98a0837077492d53dd252ab30bc3e43e41e504f4","analyzedAt":"2026-08-16T13:02:01.396Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}