{"record":{"id":"7672080449b3473a","repo":"jdx/mise","slug":"rustc-identity-is-missing-its-version","errorCode":null,"errorMessage":"rustc identity is missing its version","messagePattern":"rustc identity is missing its version","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cache/rustc.rs","lineNumber":635,"sourceCode":"            bail!(\"cache agent did not store the rustc identity\");\n        };\n        stdout\n    };\n    let verbose = std::str::from_utf8(&stdout).wrap_err(\"rustc identity is not UTF-8\")?;\n    let release = identity_field(verbose, \"release\")?;\n    let host = identity_field(verbose, \"host\")?;\n    let rustc_version = verbose\n        .lines()\n        .filter(|line| {\n            line.starts_with(\"rustc \")\n                || line.starts_with(\"commit-hash:\")\n                || line.starts_with(\"commit-date:\")\n                || line.starts_with(\"LLVM version:\")\n        })\n        .collect::<Vec<_>>()\n        .join(\"; \");\n    if rustc_version.is_empty() {\n        bail!(\"rustc identity is missing its version\");\n    }\n    let toolchain = std::env::var(\"RUSTUP_TOOLCHAIN\")\n        .ok()\n        .filter(|value| !value.is_empty())\n        .unwrap_or_else(|| release.to_string());\n    Ok(CompilerIdentity {\n        toolchain,\n        rustc_version,\n        host: host.to_string(),\n    })\n}\n\nfn identity_field<'a>(verbose: &'a str, field: &str) -> Result<&'a str> {\n    verbose\n        .lines()\n        .find_map(|line| line.strip_prefix(&format!(\"{field}: \")))\n        .filter(|value| !value.is_empty())\n        .ok_or_else(|| eyre::eyre!(\"rustc identity is missing {field}\"))","sourceCodeStart":617,"sourceCodeEnd":653,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/cache/rustc.rs#L617-L653","documentation":"compiler_identity() scans the 'rustc -vV' output for lines starting with 'rustc ', 'commit-hash:', 'commit-date:' or 'LLVM version:' to build the compiler fingerprint (src/cache/rustc.rs:624-636). If none match, the output is not genuine rustc verbose-version text and the identity is rejected — the cache refuses to key on a compiler it cannot identify. Sibling checks (identity_field, src/cache/rustc.rs:648-654) likewise require non-empty 'release:' and 'host:' lines.","triggerScenarios":"RUSTC pointing at a wrapper or proxy that prints different text for -vV (custom scripts, chained RUSTC_WRAPPER setups, an old sccache-style shim), a rustc distribution with nonstandard -vV output, or truncated/corrupted stdout replayed from the agent's identity store.","commonSituations":"Custom RUSTC in CI pipelines; nested RUSTC_WRAPPER configurations where an outer wrapper mangles -vV; a stored identity blob corrupted on disk.","solutions":["Run \"$RUSTC\" -vV and compare with real rustc output — it must contain the standard rustc/commit-hash/commit-date/LLVM version/release/host lines","Point RUSTC at genuine rustc, or make any wrapper faithfully forward -vV to the real compiler","For nonstandard compilers, disable rust caching for that task","If the agent returned a stale stored identity, a fresh session (new identity cache) clears it"],"exampleFix":"# before: wrapper swallows the identity query\nRUSTC=./my-wrapper # ./my-wrapper -vV prints 'my-wrapper 1.0'\n# after: forward -vV to the real compiler\nmy-wrapper() { if [ \"$1\" = '-vV' ]; then exec /real/path/rustc \"$@\"; fi; ...; }","handlingStrategy":"validation","validationCode":"\"$RUSTC\" -vV | grep -q -E '^(rustc |commit-hash:|commit-date:|LLVM version:|release:|host:)' \\\n  || echo 'RUSTC does not speak rustc -vV — exclude it from the rust cache'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point RUSTC at genuine rustc for cached tasks","Make wrappers forward -vV to the real compiler verbatim","Prefer disabling the rust cache for exotic compilers over fighting the identity parser"],"tags":["rust","rustc","compiler","parsing","identity"],"backgroundTag":"rustc-identity-unparseable","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}