{"record":{"id":"8127b5268147f2b7","repo":"jdx/mise","slug":"remote-rustc-action-metadata-is-invalid","errorCode":null,"errorMessage":"remote rustc action metadata is invalid","messagePattern":"remote rustc action metadata is invalid","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/agent.rs","lineNumber":1196,"sourceCode":"            let cas_duration_ns = duration_ns(cas_started);\n            agent.remember_verified_blob(&digest, &path);\n            Ok((path, true, cas_duration_ns))\n        })\n        .await??;\n        atomic_saturating_add(&self.stats.local_cas_write_duration_ns, cas_duration_ns);\n        if stored {\n            self.stats.stores.fetch_add(1, Ordering::Relaxed);\n            atomic_saturating_add(&self.stats.stored_bytes, digest_size);\n        }\n        Ok(path)\n    }\n\n    fn parse_rustc_metadata(path: &Path) -> Result<RustcMetadata> {\n        let bytes = fs::read(path)?;\n        let metadata: RustcMetadata = serde_json::from_slice(&bytes)?;\n        if metadata.version != 1 || metadata.kind != \"rustc\" || canonical_json(&metadata)? != bytes\n        {\n            bail!(\"remote rustc action metadata is invalid\");\n        }\n        Ok(metadata)\n    }\n\n    fn parse_cache_directory(path: &Path) -> Result<CacheDirectory> {\n        let bytes = fs::read(path)?;\n        let directory: CacheDirectory = serde_json::from_slice(&bytes)?;\n        if directory.version != 1 || canonical_json(&directory)? != bytes {\n            bail!(\"remote action output directory is invalid\");\n        }\n        Ok(directory)\n    }\n\n    #[cfg(test)]\n    fn load_cache_directory(&self, digest: &CacheDigest) -> Result<CacheDirectory> {\n        let path = self\n            .find_verified_blob(digest)?\n            .ok_or_else(|| eyre::eyre!(\"remote action output directory is missing\"))?;","sourceCodeStart":1178,"sourceCodeEnd":1214,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/crates/mise-cache-core/src/agent.rs#L1178-L1214","documentation":"parse_rustc_metadata validates a fetched rustc action-metadata blob: it must deserialize as RustcMetadata, carry version==1 and kind==\"rustc\", and its bytes must equal the canonical JSON re-serialization. Anything else is rejected as invalid remote data rather than trusted.","triggerScenarios":"The remote cache serves a metadata blob written by an incompatible client (different version field or kind string), a hand-edited blob, or a corrupted/truncated upload that still parses as JSON.","commonSituations":"Version skew between agents sharing one remote bucket; partial uploads from interrupted transfers; external tooling rewriting cache objects.","solutions":["Delete or overwrite the bad remote blob (keyed by its content digest) so the next run re-stores a valid one","Pin all sessions to the same mise-cache-core version so the metadata schema (version 1, kind \"rustc\") matches","If it persists, fetch the blob and compare its version/kind fields against the expected {\"version\":1,\"kind\":\"rustc\"}"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Invalid remote metadata => treat as cache miss and re-execute/restore locally\nif let Err(e) = restore_prefetched(&agent).await {\n    if e.to_string().contains(\"remote rustc action metadata is invalid\") {\n        evict_remote_blobs_for_action(&digest).await?;\n        run_action_locally(&action).await?;\n    } else { return Err(e); }\n}","preventionTips":["Pin one mise-cache-core version across all writers to a shared remote bucket","Never hand-edit remote cache objects; they are digest-verified and canonical-form checked","Alert on repeated integrity failures from one writer — it indicates a broken client"],"tags":["mise-cache","rustc","cache-corruption","validation"],"backgroundTag":"cache-corruption","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}