jdx/mise · error

remote cache blob pack returned a duplicate digest

Error message

remote cache blob pack returned a duplicate digest

What it means

While unpacking a blob pack from the remote build cache, each framed digest must be unique; a seen-set tracks digests already emitted. If the server sends the same digest twice, the client bails rather than duplicating blob entries. This guards against malformed or malicious server responses.

Solutions

  1. Fix or upgrade the remote cache server so it emits each requested digest exactly once
  2. Verify the cache URL uses HTTPS so the pack cannot be tampered with in transit
  3. Clear the client cache entry and retry the pack request in case of a stale/corrupt response
  4. Check for proxy middleware that could duplicate chunks in the response stream
Defensive patterns

Strategy: validation

Try / catch

match unpack_blob_pack(response, requested, dir) {
    Err(e) if e.to_string().contains("duplicate digest") => {
        // treat server as non-conformant: invalidate cache entry and report
    }
    Ok(blobs) => blobs,
}

Prevention

When it happens

Trigger: A remote cache server (or a proxy/attacker tampering with the response) returns a BlobPackResponse whose stream contains two framing headers for the identical digest, detected by seen.insert(digest) returning false during unpack_blob_pack.

Common situations: Buggy or non-conformant cache server implementations, corrupted or replayed pack responses, MITM tampering on unauthenticated HTTP cache connections.

Related errors


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

Appendix: source

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

                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();
            let count = reader.read(&mut buffer[..limit]).await?;
            if count == 0 {
                bail!("remote cache blob pack ended before a blob was complete");

View on GitHub (pinned to 533346cc37)