{"record":{"id":"04b8f9cda960cedf","repo":"jdx/mise","slug":"cache-agent-returned-an-unexpected-prediction-resp","errorCode":null,"errorMessage":"cache agent returned an unexpected prediction response","messagePattern":"cache agent returned an unexpected prediction response","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"warning","filePath":"src/cache/rustc.rs","lineNumber":241,"sourceCode":"}\n\nfn record_prediction_value(invocation: CacheDigest, action: CacheDigest, payload: String) {\n    let result = (|| {\n        let task = std::env::var(session::TASK_ENV)\n            .wrap_err_with(|| format!(\"{} is not set\", session::TASK_ENV))?;\n        let responses = session::request_agent(&[AgentRequest::RecordActionPrediction {\n            task,\n            prediction: ActionPrediction {\n                invocation,\n                action,\n                adapter: \"rustc\".into(),\n                payload,\n            },\n        }])?;\n        match responses.into_iter().next() {\n            Some(AgentResponse::ActionPredictionRecorded) => Ok(()),\n            Some(AgentResponse::Error { message }) => bail!(message),\n            _ => bail!(\"cache agent returned an unexpected prediction response\"),\n        }\n    })();\n    if let Err(error) = result {\n        eprintln!(\"mise rustc cache warning: action prediction was not recorded: {error:#}\");\n    }\n}\n\nfn verify_environment(environment: &BTreeMap<String, Option<String>>) -> Result<()> {\n    for (name, expected) in environment {\n        let actual = std::env::var_os(name)\n            .map(|value| {\n                value.into_string().map_err(|_| {\n                    eyre::eyre!(\"compiler environment input is not valid UTF-8: {name}\")\n                })\n            })\n            .transpose()?;\n        if &actual != expected {\n            bail!(\"compiler environment input changed: {name}\");","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cache/rustc.rs#L223-L259","documentation":"After sending RecordActionPrediction, the wrapper expects exactly AgentResponse::ActionPredictionRecorded (or Error). Any other variant is a protocol violation; unlike the other cache errors it is caught and only printed as 'mise rustc cache warning: action prediction was not recorded: ...' — the build continues, the entry just is not cached (src/cache/rustc.rs:241).","triggerScenarios":"The agent replies with an unexpected variant to a record request — agent crash/restart between request and reply, or version skew in the response enum.","commonSituations":"Same family as the other protocol errors: mixed mise versions, agent dying under concurrent load. Harmless for correctness (compile still happens) but silently loses caching.","solutions":["Treat the warning as transient: re-run the build after restarting the cache agent so the prediction records cleanly","Verify agent and wrapper mise versions match to stop the variant mismatch","If warnings persist, disable the rustc cache wrapper for that environment"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Already non-fatal: log-scrape to detect cache loss\n# e.g. CI step:\n# grep -c 'action prediction was not recorded' build.log > cache_warnings.txt\n# alert when it grows on every run","preventionTips":["Check build logs for rustc cache warnings — repeated ones mean version skew","Restart agents after upgrades so records succeed again","Treat chronic warnings as loss of caching, not a build failure"],"tags":["mise","rustc-cache","cache-agent","protocol","warning"],"backgroundTag":"cache-agent-protocol-error","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}