{"record":{"id":"dbbc9aaadc799bb8","repo":"jdx/mise","slug":"cached-rustc-action-result-has-an-invalid-identity","errorCode":null,"errorMessage":"cached rustc action result has an invalid identity","messagePattern":"cached rustc action result has an invalid identity","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cache/rustc.rs","lineNumber":286,"sourceCode":"    discovered: &DiscoveredInputs,\n    restore_outputs: bool,\n) -> Result<Option<CachedCompilation>> {\n    let responses = session::request_agent(&[AgentRequest::FindActionResult {\n        action: action.digest.clone(),\n    }])?;\n    let Some(response) = responses.into_iter().next() else {\n        bail!(\"cache agent did not return an action lookup response\");\n    };\n    let result = match response {\n        AgentResponse::ActionResult { result } => match result {\n            Some(result) => result,\n            None => return Ok(None),\n        },\n        AgentResponse::Error { message } => bail!(message),\n        _ => bail!(\"cache agent returned an unexpected action lookup response\"),\n    };\n    if result.version != 1 || result.action != action.digest {\n        bail!(\"cached rustc action result has an invalid identity\");\n    }\n    let metadata_digest = result\n        .metadata\n        .ok_or_else(|| eyre::eyre!(\"cached rustc action result has no metadata\"))?;\n    let output_root_digest = result\n        .output_root\n        .ok_or_else(|| eyre::eyre!(\"cached rustc action result has no output root\"))?;\n    let roots = find_blobs(&[\n        action.digest.clone(),\n        metadata_digest.clone(),\n        output_root_digest.clone(),\n    ])?;\n    let cached_action = read_verified_blob(&roots[0], &action.digest, \"action descriptor\")?;\n    if cached_action != action.bytes {\n        bail!(\"cached rustc action descriptor does not match the invocation\");\n    }\n    let metadata: RustcMetadata =\n        read_canonical_blob(&roots[1], &metadata_digest, \"rustc metadata\")?;","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cache/rustc.rs#L268-L304","documentation":"A returned ActionResult must be version 1 and carry the exact action digest that was requested. A mismatch means the entry is from an incompatible cache format or points at another action, so restoring it could produce wrong outputs; the wrapper bails on identity (src/cache/rustc.rs:286).","triggerScenarios":"Cache entries written by a newer/older mise with a different result schema (version != 1), or an agent serving a result whose action digest differs from the query — corruption or index skew after an upgrade.","commonSituations":"Reusing an agent store across mise upgrades that bumped the result version; partial cache writes leaving mismatched digests.","solutions":["Delete the agent's cached result store so entries are re-recorded under the current schema","Restart the agent and rebuild from a clean cache","Pin one mise version for agent and wrappers; report if identity errors persist on a single version"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Rust: on identity failure, bypass cache and compile normally\nmatch restore_result(&action, ..) {\n    Err(e) if e.to_string().contains(\"invalid identity\") => run_plain_rustc(),\n    r => r?,\n}","preventionTips":["Drop cache stores on mise upgrades (schema version bumps)","Keep result entries keyed to one mise version","Automate cache invalidation in CI cache restore keys (include mise version)"],"tags":["mise","rustc-cache","cache-corruption","digest-mismatch","version-mismatch"],"backgroundTag":"cache-corruption","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}