{"record":{"id":"1501f64d88828fc4","repo":"jdx/mise","slug":"remote-cache-blob-pack-payload-byte-metadata-misma","errorCode":null,"errorMessage":"remote cache blob pack payload byte metadata mismatch: expected {}, decoded {}","messagePattern":"remote cache blob pack payload byte metadata mismatch: expected (.+?), decoded (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/lib.rs","lineNumber":339,"sourceCode":"            bail!(\n                \"remote cache blob pack content length metadata mismatch: expected {}, decoded {}\",\n                content_length,\n                decoded.framed_bytes\n            );\n        }\n        if let Some(blob_count) = self.blob_count\n            && blob_count != decoded.blob_count\n        {\n            bail!(\n                \"remote cache blob pack blob count metadata mismatch: expected {}, decoded {}\",\n                blob_count,\n                decoded.blob_count\n            );\n        }\n        if let Some(payload_bytes) = self.payload_bytes\n            && payload_bytes != decoded.payload_bytes\n        {\n            bail!(\n                \"remote cache blob pack payload byte metadata mismatch: expected {}, decoded {}\",\n                payload_bytes,\n                decoded.payload_bytes\n            );\n        }\n        Ok(BlobPackResponseStats {\n            blob_count: self.blob_count.unwrap_or(decoded.blob_count),\n            payload_bytes: self.payload_bytes.unwrap_or(decoded.payload_bytes),\n            framed_bytes: self.content_length.unwrap_or(decoded.framed_bytes),\n        })\n    }\n}\n\nfn optional_u64_header(headers: &HeaderMap, name: &str) -> Result<Option<u64>> {\n    let Some(value) = headers.get(name) else {\n        return Ok(None);\n    };\n    let value = value","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/crates/mise-cache-core/src/lib.rs#L321-L357","documentation":"Thrown while validating a blob-pack download (crates/mise-cache-core/src/lib.rs:339): the payload-bytes metadata header (BLOB_PACK_BYTES_HEADER) disagrees with decoded.payload_bytes — the sum of raw blob payload sizes actually decoded. Note this checks payload bytes, distinct from framed_bytes (which includes magic, digests, and per-record framing), so it catches servers that report content size rather than framed size or vice versa.","triggerScenarios":"Calling get_blob_pack/decode_blob_pack (lib.rs:899) where the server's payload-bytes header counts something other than the sum of blob payloads — e.g. it reports total framed size, uncompressed vs compressed size, or includes record headers in the count.","commonSituations":"A custom or third-party cache server implementing the pack format from ambiguous docs; version skew after a pack-format change; compression applied in transit changing perceived payload sizes.","solutions":["Retry once to rule out a transient race between header computation and body write","Disable blob packs for this remote to fall back to individually verified per-blob GETs (each blob is digest-checked independently)","If you operate the server, make the payload-bytes header equal the exact sum of decoded blob payload lengths, and content length equal the framed size — match the semantics in BlobPackResponseMetadata::validate","Report/fix version skew: align client and server on the same pack wire format"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.get_blob_pack(&digests, &staging).await {\n    Err(e) if e.to_string().contains(\"payload byte metadata mismatch\") => {\n        client.disable_blob_packs();\n        fallback_per_blob(&client, &digests)\n    }\n    other => other?,\n}","preventionTips":["Server implementers: payload-bytes = sum of blob payloads, content length = framed size — test both against the client's validator","Don't shim a custom server by copying header semantics from a different pack format","Keep a conformance test that round-trips a pack through encode/decode with headers"],"tags":["mise","cache","network","integrity","blob-pack","metadata-mismatch"],"backgroundTag":"response-body-corruption","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}