{"record":{"id":"134715cf40cd83c8","repo":"jdx/mise","slug":"cache-agent-did-not-return-an-action-prediction-re","errorCode":null,"errorMessage":"cache agent did not return an action prediction response","messagePattern":"cache agent did not return an action prediction response","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cache/rustc.rs","lineNumber":134,"sourceCode":"}\n\nfn restore_predicted_result(\n    rustc: &OsStr,\n    invocation: &RustcInvocation,\n    outputs: &RustcOutputs,\n    working_dir: &Path,\n    restore_outputs: bool,\n) -> Result<Option<CachedCompilation>> {\n    let task = std::env::var(session::TASK_ENV)\n        .wrap_err_with(|| format!(\"{} is not set\", session::TASK_ENV))?;\n    let mut context = base_action_context(rustc, working_dir)?;\n    let invocation_digest = invocation.invocation_digest(&context)?;\n    let responses = session::request_agent(&[AgentRequest::FindActionPrediction {\n        task,\n        invocation: invocation_digest.clone(),\n    }])?;\n    let Some(response) = responses.into_iter().next() else {\n        bail!(\"cache agent did not return an action prediction response\");\n    };\n    let prediction = match response {\n        AgentResponse::ActionPrediction {\n            prediction: Some(prediction),\n        } => prediction,\n        AgentResponse::ActionPrediction { prediction: None } => return Ok(None),\n        AgentResponse::Error { message } => bail!(message),\n        _ => bail!(\"cache agent returned an unexpected action prediction response\"),\n    };\n    if prediction.adapter != \"rustc\" || prediction.invocation != invocation_digest {\n        bail!(\"cache agent returned an incompatible rustc action prediction\");\n    }\n    let input_prediction: RustcInputPrediction = serde_json::from_str(&prediction.payload)?;\n    if String::from_utf8(canonical_json(&input_prediction)?)? != prediction.payload {\n        bail!(\"cache agent returned a non-canonical rustc action prediction\");\n    }\n    let discovered = input_prediction.discover(working_dir, &context.path_mappings)?;\n    discovered.clone().apply_to(&mut context)?;","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cache/rustc.rs#L116-L152","documentation":"mise's rustc wrapper cache talks to a background cache agent over a socket (MISE_CACHE_SOCKET) with a request/response protocol. When the wrapper sends FindActionPrediction, it expects at least one AgentResponse back; an empty response vector violates the protocol and bails (src/cache/rustc.rs:134).","triggerScenarios":"The cache agent daemon returns zero responses for a one-request batch — a crashed/restarted agent mid-request, a version-skewed agent speaking an older protocol, or a socket race where the wrapper connected to a dying agent.","commonSituations":"Running builds while `mise` was upgraded underneath a live agent; agent killed by OOM or manually during a compile; stale MISE_CACHE_* env vars pointing at an old socket after a daemon restart.","solutions":["Restart the build/session so a fresh cache agent starts with matching env (MISE_CACHE_TASK, MISE_CACHE_SOCKET)","Upgrade mise so the wrapper and agent come from the same binary/version","If it persists, disable the rustc cache for the session (remove the rustc wrapper from RUSTC_WRAPPER / mise settings) and report the protocol violation upstream"],"exampleFix":"# before: stale agent env\nexport RUSTC_WRAPPER=$HOME/.local/share/mise/rustc-wrapper\n\n# after: start clean\nunset MISE_CACHE_SOCKET MISE_CACHE_TASK MISE_CACHE_STAGING_DIR\ncargo clean -p mycrate && cargo build","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Bash: treat cache-agent protocol failures as transient\ncargo build 2>err.log || true\nif grep -q 'cache agent did not return' err.log; then\n  unset MISE_CACHE_SOCKET MISE_CACHE_TASK MISE_CACHE_STAGING_DIR\n  cargo build   # fresh agent, same inputs\nfi","preventionTips":["Restart cache agents after upgrading mise","Keep agent and wrapper on the same mise binary/version","Don't reuse MISE_CACHE_* env vars across daemon restarts"],"tags":["mise","rustc-cache","cache-agent","protocol","ipc"],"backgroundTag":"cache-agent-protocol-error","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}