jdx/mise · error · eyre::Report

cache agent did not return the rustc identity

Error message

cache agent did not return the rustc identity

What it means

compiler_identity() asks the session agent for the cached 'rustc -vV' output via FindExecutableIdentity, keyed on the resolved executable plus RUSTUP_HOME/RUSTUP_TOOLCHAIN (src/cache/rustc.rs:574-586). If the first response is absent or not an ExecutableIdentity variant, the shim throws: the agent protocol exchange is broken. This is distinct from a mere identity miss, which is ExececutableIdentity { stdout: None } and triggers a local 'rustc -vV' run instead.

Source

Thrown at src/cache/rustc.rs:585

    }
    if !expected.is_empty() {
        bail!("cached rustc output set is incomplete");
    }
    Ok(files)
}

fn compiler_identity(rustc: &OsStr) -> Result<CompilerIdentity> {
    let executable = resolve_executable(rustc)?;
    let environment = ["RUSTUP_HOME", "RUSTUP_TOOLCHAIN"]
        .into_iter()
        .map(|name| (name.into(), std::env::var(name).ok()))
        .collect::<BTreeMap<_, _>>();
    let responses = session::request_agent(&[AgentRequest::FindExecutableIdentity {
        executable: executable.clone(),
        environment: environment.clone(),
    }])?;
    let Some(AgentResponse::ExecutableIdentity { stdout }) = responses.into_iter().next() else {
        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!(

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Restart the mise task/session so the shim talks to the agent spawned by the same mise binary
  2. Unset inherited MISE_CACHE_* variables in shell profiles and CI images
  3. Confirm mise versions match inside and outside the task
  4. Verify nothing strips MISE_CACHE_SOCKET from the task environment
Defensive patterns

Strategy: validation

Validate before calling

# confirm a live agent of the current session before relying on the cache:
test -S "$MISE_CACHE_SOCKET" || echo 'run inside a mise task with rust cache enabled'

Type guard

fn is_identity_response(r: &AgentResponse) -> bool {
    matches!(r, AgentResponse::ExecutableIdentity { .. })
}

Prevention

When it happens

Trigger: Response-stream skew (a different AgentResponse variant answered the request), a stale MISE_CACHE_SOCKET pointing at an agent from another mise build, or an agent bug; the error aborts the cache context build (base_action_context), so the invocation degrades to prediction lookup or a plain compile.

Common situations: Inherited MISE_CACHE_* environment from an older session; two mise versions sharing a session dir; wrapping the shim in another tool that strips or reorders the agent socket env.

Related errors


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