jdx/mise · error · eyre::Report

rustc identity command failed: {}

Error message

rustc identity command failed: {}

What it means

On an identity cache miss, the shim runs '<rustc> -vV' itself, forwarding RUSTUP_HOME/RUSTUP_TOOLCHAIN (and env_remove for unset ones) (src/cache/rustc.rs:590-607). A non-zero exit is fatal for the cache layer and the command's stderr is embedded in the message. Unlike most errors here, the same broken compiler will usually also fail the subsequent real compilation, so the underlying toolchain problem must actually be fixed.

Source

Thrown at src/cache/rustc.rs:603

        bail!("cache agent did not return the rustc identity");
    };
    let stdout = if let Some(stdout) = stdout {
        stdout
    } else {
        let mut command = Command::new(&executable);
        command.arg("-vV");
        for (name, value) in &environment {
            if let Some(value) = value {
                command.env(name, value);
            } else {
                command.env_remove(name);
            }
        }
        let output = command
            .output()
            .wrap_err("failed to query the rustc identity")?;
        if !output.status.success() {
            bail!(
                "rustc identity command failed: {}",
                String::from_utf8_lossy(&output.stderr)
            );
        }
        let responses = session::request_agent(&[AgentRequest::StoreExecutableIdentity {
            executable,
            environment,
            stdout: output.stdout,
        }])?;
        let Some(AgentResponse::ExecutableIdentity {
            stdout: Some(stdout),
        }) = responses.into_iter().next()
        else {
            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")?;

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Reproduce manually with the same environment: RUSTUP_TOOLCHAIN=<value> RUSTUP_HOME=<value> rustc -vV — the embedded stderr names the problem
  2. Install the missing toolchain: rustup toolchain install <name>
  3. Repair a broken proxy: run 'rustup which rustc' and reinstall rustup if it errors
  4. If a custom RUSTC or wrapper is in play, make it answer -vV like rustc or disable the task's rust cache

Example fix

# before: env pins an uninstalled toolchain
export RUSTUP_TOOLCHAIN=1.88.0-x86_64-unknown-linux-gnu # not installed
# after
rustup toolchain install 1.88.0-x86_64-unknown-linux-gnu
export RUSTUP_TOOLCHAIN=1.88.0-x86_64-unknown-linux-gnu
Defensive patterns

Strategy: validation

Validate before calling

# reproduce exactly what the shim runs before enabling the cache:
env | grep -E '^RUSTUP_(HOME|TOOLCHAIN)='
rustc -vV || echo 'rustc -vV failing — fix the toolchain before enabling the rust cache'

Prevention

When it happens

Trigger: A rustup proxy that cannot resolve RUSTUP_TOOLCHAIN (toolchain name not installed), a corrupted rustup installation, resolve_executable finding a non-functional rustc on PATH, or a compiler wrapper that errors on -vV.

Common situations: RUSTUP_TOOLCHAIN pinned in the environment to an uninstalled toolchain; partial rustup install or missing toolchain after a cleanup; custom RUSTC/wrapper that does not implement -vV; disk/resource limits preventing process spawn.

Related errors


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