{"record":{"id":"b61dccd3161f00fa","repo":"jdx/mise","slug":"cache-agent-returned-an-incompatible-rustc-action","errorCode":null,"errorMessage":"cache agent returned an incompatible rustc action prediction","messagePattern":"cache agent returned an incompatible rustc action prediction","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cache/rustc.rs","lineNumber":145,"sourceCode":"    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)?;\n    let action = invocation.action(context)?;\n    let restored = restore_result(&action, outputs, &discovered, restore_outputs)?;\n    if restored.is_some() {\n        record_prediction_value(invocation_digest, action.digest.clone(), prediction.payload);\n    }\n    Ok(restored)\n}\n\nfn action_from_dep_info(\n    rustc: &OsStr,\n    invocation: &RustcInvocation,","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cache/rustc.rs#L127-L163","documentation":"A returned action prediction must carry adapter == \"rustc\" and the same invocation digest the wrapper sent. If either differs, the prediction belongs to another adapter or another compiler invocation, so applying it would poison the cache and the wrapper bails with 'incompatible rustc action prediction' (src/cache/rustc.rs:145).","triggerScenarios":"The agent serves a prediction recorded under a different invocation digest (digest computation changed between mise versions) or tagged for a different adapter; e.g. after upgrading mise while the agent kept pre-upgrade entries.","commonSituations":"mise upgrade changing the invocation-digest recipe; an agent shared by several wrapper types returning a wrong-adapter record; corrupted agent-side index mapping digests to predictions.","solutions":["Restart the cache agent and rebuild so fresh, self-consistent predictions are recorded","Clear the agent's cache store so stale/mislabeled predictions are dropped","Align on one mise version across the agent and all build shells; if it recurs, disable the rustc cache and report it"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Rust (if invoking the wrapper): fall back to plain rustc on protocol errors\nmatch cache_lookup() {\n    Err(e) if e.to_string().contains(\"incompatible rustc action prediction\") => {\n        run_plain_rustc()?; // bypass cache, recompile\n    }\n    r => r?,\n}","preventionTips":["Clear the agent's prediction store after mise upgrades","Never share one cache agent across different adapters/versions","Rebuild once after any toolchain/mise change to re-record"],"tags":["mise","rustc-cache","cache-agent","digest-mismatch","protocol"],"backgroundTag":"cache-agent-protocol-error","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}