jdx/mise · error
remote cache blob pack ended before a blob was complete
Error message
remote cache blob pack ended before a blob was complete
What it means
When streaming a blob out of a remote cache pack, the client reads until the digest's declared size is consumed. If the underlying reader returns EOF (0 bytes) while bytes remain, the pack ended prematurely and the blob would be truncated, so the operation bails instead of writing an incomplete blob.
Solutions
- Retry the blob pack download; transient network truncation is the usual cause
- Verify the remote cache server writes the full framed payload for each digest
- Check proxy/load-balancer idle or body-size timeouts and raise them for large blobs
- Confirm content-length handling is not truncating the stream
Defensive patterns
Strategy: retry
Try / catch
for attempt in 0..3 {
match unpack_blob_pack(...).await {
Err(e) if e.to_string().contains("ended before") && attempt < 2 => continue,
other => break other,
}
} Prevention
- Run downloads on stable networks; avoid aggressive proxy idle timeouts
- Raise proxy/LB body timeouts for large blobs
- Prefer resumable/chunked fetches for very large packs
When it happens
Trigger: reader.read() returns Ok(0) inside the while remaining > 0 loop of unpack_blob_pack — the HTTP body/pack stream terminated before delivering digest.size bytes for the current blob.
Common situations: Network interruption mid-download, server closing the connection early, truncated response due to proxy timeout, server bug writing fewer bytes than framed.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- get failed for
- blob chunk upload failed
- blob upload failed
- cached rustc output directory has unsupported entries
- could not fetch setup repository using local Git…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/fa7cd3530704c2a2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/mise-cache-core/src/lib.rs:844
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");
}
output.write_all(&buffer[..count]).await?;
hasher.update(&buffer[..count]);
remaining -= count as u64;
}
output.flush().await?;
drop(output);
if !hasher.matches(&digest.hash) {
bail!("remote cache blob pack failed digest verification");
}
blobs.push((digest, path));
}
let blob_count = blobs.len().try_into().unwrap_or(u64::MAX);
let metadata = metadata.validate(BlobPackResponseStats {
blob_count,
payload_bytes,
framed_bytes,
})?;View on GitHub (pinned to 533346cc37)