jdx/mise · error · eyre::Report

rustc identity is missing its version

Error message

rustc identity is missing its version

What it means

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.

Source

Thrown at src/cache/rustc.rs:635

            bail!("cache agent did not store the rustc identity");
        };
        stdout
    };
    let verbose = std::str::from_utf8(&stdout).wrap_err("rustc identity is not UTF-8")?;
    let release = identity_field(verbose, "release")?;
    let host = identity_field(verbose, "host")?;
    let rustc_version = verbose
        .lines()
        .filter(|line| {
            line.starts_with("rustc ")
                || line.starts_with("commit-hash:")
                || line.starts_with("commit-date:")
                || line.starts_with("LLVM version:")
        })
        .collect::<Vec<_>>()
        .join("; ");
    if rustc_version.is_empty() {
        bail!("rustc identity is missing its version");
    }
    let toolchain = std::env::var("RUSTUP_TOOLCHAIN")
        .ok()
        .filter(|value| !value.is_empty())
        .unwrap_or_else(|| release.to_string());
    Ok(CompilerIdentity {
        toolchain,
        rustc_version,
        host: host.to_string(),
    })
}

fn identity_field<'a>(verbose: &'a str, field: &str) -> Result<&'a str> {
    verbose
        .lines()
        .find_map(|line| line.strip_prefix(&format!("{field}: ")))
        .filter(|value| !value.is_empty())
        .ok_or_else(|| eyre::eyre!("rustc identity is missing {field}"))

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Run "$RUSTC" -vV and compare with real rustc output — it must contain the standard rustc/commit-hash/commit-date/LLVM version/release/host lines
  2. Point RUSTC at genuine rustc, or make any wrapper faithfully forward -vV to the real compiler
  3. For nonstandard compilers, disable rust caching for that task
  4. If the agent returned a stale stored identity, a fresh session (new identity cache) clears it

Example fix

# before: wrapper swallows the identity query
RUSTC=./my-wrapper # ./my-wrapper -vV prints 'my-wrapper 1.0'
# after: forward -vV to the real compiler
my-wrapper() { if [ "$1" = '-vV' ]; then exec /real/path/rustc "$@"; fi; ...; }
Defensive patterns

Strategy: validation

Validate before calling

"$RUSTC" -vV | grep -q -E '^(rustc |commit-hash:|commit-date:|LLVM version:|release:|host:)' \
  || echo 'RUSTC does not speak rustc -vV — exclude it from the rust cache'

Prevention

When it happens

Trigger: 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.

Common situations: Custom RUSTC in CI pipelines; nested RUSTC_WRAPPER configurations where an outer wrapper mangles -vV; a stored identity blob corrupted on disk.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/7672080449b3473a. Report an issue: GitHub.