{"record":{"id":"e3283f4a72998035","repo":"jdx/mise","slug":"cache-agent-returned-an-unexpected-blob-lookup-res","errorCode":null,"errorMessage":"cache agent returned an unexpected blob lookup response","messagePattern":"cache agent returned an unexpected blob lookup response","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cache/rustc.rs","lineNumber":508,"sourceCode":"    match response {\n        AgentResponse::Blobs { paths } if paths.len() == digests.len() => paths\n            .into_iter()\n            .zip(digests)\n            .map(|(path, digest)| match path {\n                Some(path) => Ok(path),\n                None => bail!(\"cached rustc action is missing blob {}\", digest.hash),\n            })\n            .collect(),\n        AgentResponse::Blobs { .. } => {\n            bail!(\"cache agent returned an incomplete blob lookup response\")\n        }\n        AgentResponse::Blob { path: Some(path) } if digests.len() == 1 => Ok(vec![path]),\n        AgentResponse::Blob { path: None } if digests.len() == 1 => {\n            let digest = &digests[0];\n            bail!(\"cached rustc action is missing blob {}\", digest.hash)\n        }\n        AgentResponse::Error { message } => bail!(message),\n        _ => bail!(\"cache agent returned an unexpected blob lookup response\"),\n    }\n}\n\nfn read_canonical_blob<T>(path: &Path, digest: &CacheDigest, description: &str) -> Result<T>\nwhere\n    T: DeserializeOwned + Serialize,\n{\n    let bytes = read_verified_blob(path, digest, description)?;\n    let value = serde_json::from_slice(&bytes)\n        .wrap_err_with(|| format!(\"cached {description} is not valid JSON\"))?;\n    if canonical_json(&value)? != bytes {\n        bail!(\"cached {description} is not canonical JSON\");\n    }\n    Ok(value)\n}\n\nfn read_verified_blob(path: &Path, digest: &CacheDigest, description: &str) -> Result<Vec<u8>> {\n    let mut bytes = Vec::new();","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/cache/rustc.rs#L490-L526","documentation":"The blob lookup returned a response variant that does not correspond to FindBlobs at all — e.g. Stored, ActionPrediction, or Hello (src/cache/rustc.rs:508). Responses travel as JSON lines matched positionally on one stream, so a variant mismatch means request/response skew: a version-skewed agent, a desynchronized stream, or a non-mise process answering on MISE_CACHE_SOCKET. This is a wiring error, not corrupted cache data.","triggerScenarios":"MISE_CACHE_SOCKET inherited from a session running another mise build with a different AgentResponse enum shape; a truncated or garbled line deserializing into the wrong variant; a custom tool pretending to be the cache agent.","commonSituations":"Stale exported MISE_CACHE_* environment in CI images or shell profiles; mixed mise versions on one machine; sockets left behind by crashed sessions being reused.","solutions":["Restart the mise session/task so shim and agent share one binary and protocol revision","Unset inherited MISE_CACHE_* variables before invoking mise so tasks never attach to foreign agents","Verify only one mise version is installed or active for the session","If a custom client is involved, align it with AGENT_PROTOCOL_VERSION and the response enum of the running mise"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# ensure the task is talking to the agent of the session that launched it:\ntest -S \"$MISE_CACHE_SOCKET\" || echo 'no live cache agent socket — unset MISE_CACHE_* and rerun inside a mise task'","typeGuard":"fn is_unexpected_lookup(r: &AgentResponse) -> bool {\n    !matches!(r, AgentResponse::Blobs { .. } | AgentResponse::Blob { .. } | AgentResponse::Error { .. })\n}","tryCatchPattern":null,"preventionTips":["Never inherit MISE_CACHE_* across sessions or machines","Pin one mise version per CI image and per cache namespace","If you build custom agent clients, validate the handshake (protocol + agent_version) before sending requests"],"tags":["rust","cache","agent","protocol","serialization"],"backgroundTag":"agent-protocol-mismatch","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}