jdx/mise · error · eyre::Report

remote rustc action metadata is invalid

Error message

remote rustc action metadata is invalid

What it means

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.

Source

Thrown at crates/mise-cache-core/src/agent.rs:1196

            let cas_duration_ns = duration_ns(cas_started);
            agent.remember_verified_blob(&digest, &path);
            Ok((path, true, cas_duration_ns))
        })
        .await??;
        atomic_saturating_add(&self.stats.local_cas_write_duration_ns, cas_duration_ns);
        if stored {
            self.stats.stores.fetch_add(1, Ordering::Relaxed);
            atomic_saturating_add(&self.stats.stored_bytes, digest_size);
        }
        Ok(path)
    }

    fn parse_rustc_metadata(path: &Path) -> Result<RustcMetadata> {
        let bytes = fs::read(path)?;
        let metadata: RustcMetadata = serde_json::from_slice(&bytes)?;
        if metadata.version != 1 || metadata.kind != "rustc" || canonical_json(&metadata)? != bytes
        {
            bail!("remote rustc action metadata is invalid");
        }
        Ok(metadata)
    }

    fn parse_cache_directory(path: &Path) -> Result<CacheDirectory> {
        let bytes = fs::read(path)?;
        let directory: CacheDirectory = serde_json::from_slice(&bytes)?;
        if directory.version != 1 || canonical_json(&directory)? != bytes {
            bail!("remote action output directory is invalid");
        }
        Ok(directory)
    }

    #[cfg(test)]
    fn load_cache_directory(&self, digest: &CacheDigest) -> Result<CacheDirectory> {
        let path = self
            .find_verified_blob(digest)?
            .ok_or_else(|| eyre::eyre!("remote action output directory is missing"))?;

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Delete or overwrite the bad remote blob (keyed by its content digest) so the next run re-stores a valid one
  2. Pin all sessions to the same mise-cache-core version so the metadata schema (version 1, kind "rustc") matches
  3. If it persists, fetch the blob and compare its version/kind fields against the expected {"version":1,"kind":"rustc"}
Defensive patterns

Strategy: fallback

Try / catch

// Invalid remote metadata => treat as cache miss and re-execute/restore locally
if let Err(e) = restore_prefetched(&agent).await {
    if e.to_string().contains("remote rustc action metadata is invalid") {
        evict_remote_blobs_for_action(&digest).await?;
        run_action_locally(&action).await?;
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: 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.

Common situations: Version skew between agents sharing one remote bucket; partial uploads from interrupted transfers; external tooling rewriting cache objects.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/8127b5268147f2b7. Report an issue: GitHub.