jdx/mise · error

remote cache blob pack returned an unrequested digest

Error message

remote cache blob pack returned an unrequested digest

What it means

While decoding a blob pack, each entry's reconstructed CacheDigest must be one of the digests the client actually requested. If the server returns an entry for an unrequested digest, the client bails — the pack stream does not match the request and cannot be trusted. A subsequent check similarly rejects duplicate entries for the same digest.

Solutions

  1. Verify the request body (DigestList JSON) and response entries match; capture both with a proxy or curl
  2. Fix/upgrade the server so packs contain exactly the requested digests
  3. Check whether a shared cache/proxy is serving a pack generated for a different digest list — disable caching on the blobs:pack route
  4. Retry; if persistent, avoid blob packs (single-blob endpoint is unaffected)
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate what you request so any extra server entries are detectable:
let requested: BTreeSet<CacheDigest> = digests.iter().cloned().collect();
// after decoding: every entry must be in `requested` and unique

Type guard

fn all_requested(entries: &[CacheDigest], requested: &BTreeSet<CacheDigest>) -> bool {
    entries.iter().all(|d| requested.contains(d))
}

Try / catch

match client.get_blob_pack(&digests, staging).await {
    Err(e) if e.to_string().contains("unrequested digest") => {
        // server bug or proxy cache-key collision; fall back to single-blob fetches
    }
    other => other?,
}

Prevention

When it happens

Trigger: get_blob_pack with a digest list where the decoded pack contains an entry whose algorithm/hash/size is not in the requested set — e.g. a buggy server echoing extra blobs, or a client bug sending a subset different from what it decodes against.

Common situations: Server-side pack assembly bugs including extra objects; protocol skew where the server interprets the digest list differently; intermediaries returning a cached pack for a different request (cache-key collision on the pack endpoint).

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/43c5243a0e298c8a. Report an issue: GitHub.

Appendix: source

Thrown at crates/mise-cache-core/src/lib.rs:823

        let (algorithm, mut hasher) = match algorithm[0] {
            1 => (
                "blake3",
                BlobPackHasher::Blake3(Box::new(blake3::Hasher::new())),
            ),
            2 => ("sha256", BlobPackHasher::Sha256(sha2::Sha256::new())),
            _ => bail!("remote cache blob pack has an invalid digest algorithm"),
        };
        let mut hash = [0_u8; 32];
        reader.read_exact(&mut hash).await?;
        let mut size = [0_u8; 8];
        reader.read_exact(&mut size).await?;
        let digest = CacheDigest {
            algorithm: algorithm.into(),
            hash: hex::encode(hash),
            size: u64::from_be_bytes(size),
        };
        if !requested.contains(&digest) {
            bail!("remote cache blob pack returned an unrequested digest");
        }
        if !seen.insert(digest.clone()) {
            bail!("remote cache blob pack returned a duplicate digest");
        }
        framed_bytes = framed_bytes
            .checked_add(BLOB_PACK_HEADER_BYTES)
            .and_then(|bytes| bytes.checked_add(digest.size))
            .ok_or_else(|| eyre!("remote cache blob pack is too large"))?;
        payload_bytes = payload_bytes
            .checked_add(digest.size)
            .ok_or_else(|| eyre!("remote cache blob pack payload is too large"))?;

        let path = directory.path().join(blobs.len().to_string());
        let mut output = tokio::fs::File::create(&path).await?;
        let mut remaining = digest.size;
        let mut buffer = [0_u8; 64 * 1024];
        while remaining > 0 {
            let limit = usize::try_from(remaining.min(buffer.len() as u64)).unwrap();

View on GitHub (pinned to 533346cc37)