jdx/mise · error · eyre::Report

cache agent returned an unexpected action prediction respons

Error message

cache agent returned an unexpected action prediction response

What it means

After receiving a response to FindActionPrediction, the wrapper matches on the AgentResponse variant: ActionPrediction, or Error. Any other variant (e.g. a Blob or ActionResult reply) means the agent answered a different question than was asked — a protocol violation that bails immediately (src/cache/rustc.rs:142).

Source

Thrown at src/cache/rustc.rs:142

) -> Result<Option<CachedCompilation>> {
    let task = std::env::var(session::TASK_ENV)
        .wrap_err_with(|| format!("{} is not set", session::TASK_ENV))?;
    let mut context = base_action_context(rustc, working_dir)?;
    let invocation_digest = invocation.invocation_digest(&context)?;
    let responses = session::request_agent(&[AgentRequest::FindActionPrediction {
        task,
        invocation: invocation_digest.clone(),
    }])?;
    let Some(response) = responses.into_iter().next() else {
        bail!("cache agent did not return an action prediction response");
    };
    let prediction = match response {
        AgentResponse::ActionPrediction {
            prediction: Some(prediction),
        } => prediction,
        AgentResponse::ActionPrediction { prediction: None } => return Ok(None),
        AgentResponse::Error { message } => bail!(message),
        _ => bail!("cache agent returned an unexpected action prediction response"),
    };
    if prediction.adapter != "rustc" || prediction.invocation != invocation_digest {
        bail!("cache agent returned an incompatible rustc action prediction");
    }
    let input_prediction: RustcInputPrediction = serde_json::from_str(&prediction.payload)?;
    if String::from_utf8(canonical_json(&input_prediction)?)? != prediction.payload {
        bail!("cache agent returned a non-canonical rustc action prediction");
    }
    let discovered = input_prediction.discover(working_dir, &context.path_mappings)?;
    discovered.clone().apply_to(&mut context)?;
    let action = invocation.action(context)?;
    let restored = restore_result(&action, outputs, &discovered, restore_outputs)?;
    if restored.is_some() {
        record_prediction_value(invocation_digest, action.digest.clone(), prediction.payload);
    }
    Ok(restored)
}

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Ensure a single mise version is in play: mise where / which mise, and restart the cache agent and all shells
  2. Re-run the build in a fresh session so wrapper and agent restart together
  3. Disable the rustc cache wrapper if the mismatch persists, and file an issue with the response variant you saw
Defensive patterns

Strategy: retry

Try / catch

# Treat variant-mismatch as environment breakage: reset session and retry once
if ! cargo build 2>&1 | tee log | grep -q 'unexpected action prediction response'; then :; else
  pkill -f mise-cache-agent || true; unset MISE_CACHE_SOCKET MISE_CACHE_TASK; cargo build
fi

Prevention

When it happens

Trigger: A version-skewed or buggy cache agent that mis-routes responses (returns ActionResult/Blob for a prediction request); response/request reordering across a mismatched protocol version.

Common situations: Two mise versions on one machine (shim vs direct path) with a shared agent socket; concurrent builds hitting an agent that got upgraded mid-flight.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/ba90d1294f68cdce. Report an issue: GitHub.