{"record":{"id":"34a83e5a14391080","repo":"jdx/mise","slug":"remote-cache-blob-packs-require-a-positive-max-pac","errorCode":null,"errorMessage":"remote cache blob packs require a positive max_pack_bytes limit","messagePattern":"remote cache blob packs require a positive max_pack_bytes limit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/lib.rs","lineNumber":504,"sourceCode":"                let capabilities: RemoteCacheCapabilities =\n                    response.error_for_status()?.json().await?;\n                if capabilities.protocol.major != PROTOCOL_VERSION {\n                    bail!(\n                        \"remote cache capability protocol {} is incompatible with client protocol {PROTOCOL_VERSION}\",\n                        capabilities.protocol.major\n                    );\n                }\n                if !capabilities.features.blob_packs {\n                    return Ok(None);\n                }\n                let max_items = usize::try_from(capabilities.limits.max_batch_items)\n                    .ok()\n                    .filter(|limit| *limit > 0)\n                    .ok_or_else(|| {\n                        eyre!(\"remote cache blob packs require a positive max_batch_items limit\")\n                    })?;\n                if capabilities.limits.max_pack_bytes == 0 {\n                    bail!(\"remote cache blob packs require a positive max_pack_bytes limit\");\n                }\n                Ok(Some(BlobPackLimits {\n                    max_items: max_items.min(MAX_STAGED_BLOB_PACK_ITEMS),\n                    max_bytes: capabilities\n                        .limits\n                        .max_pack_bytes\n                        .min(MAX_STAGED_BLOB_PACK_BYTES),\n                }))\n            })\n            .await\n            .copied()\n    }\n\n    /// Download verified CAS objects using the server's negotiated blob-pack extension.\n    ///\n    /// `None` means the server does not support blob packs. Objects omitted by a\n    /// supported server are absent from `blobs`, so callers can retry them through\n    /// the ordinary single-blob endpoint.","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/crates/mise-cache-core/src/lib.rs#L486-L522","documentation":"If a server advertises blob-pack support but its limits block declares max_pack_bytes == 0, the client treats the capability document as malformed and fails. A zero byte limit means the negotiated pack size is unusable, so the client refuses to use blob packs with such a configuration. The sibling check enforces the same for max_batch_items.","triggerScenarios":"Calling get_blob_pack against a server whose capabilities JSON contains limits.max_pack_bytes = 0 (or a negative value) while features.blob_packs is true.","commonSituations":"Misconfigured server defaults (limits not initialized); a server bug emitting 0 limits; hand-edited or partially migrated server capability configuration.","solutions":["Fix the server configuration so limits.max_pack_bytes is a positive byte value","If the server misconfig cannot be fixed promptly, disable blob packs on the client side or rely on the single-blob endpoint (the capability fetch failure will surface here, so it must be fixed server-side)","Verify the capabilities endpoint response with curl and confirm the limits block values"],"exampleFix":"// before (server capabilities)\nlimits: { max_batch_items: 100, max_pack_bytes: 0 }\n// after\nlimits: { max_batch_items: 100, max_pack_bytes: 67108864 }","handlingStrategy":"validation","validationCode":"// Validate the capability document before relying on blob packs:\nif caps.features.blob_packs\n    && (caps.limits.max_pack_bytes == 0 || caps.limits.max_batch_items <= 0)\n{\n    bail!(\"server advertises blob packs with unusable limits\");\n}","typeGuard":"fn usable_pack_limits(c: &RemoteCacheCapabilities) -> bool {\n    !c.features.blob_packs || (c.limits.max_pack_bytes > 0 && c.limits.max_batch_items > 0)\n}","tryCatchPattern":null,"preventionTips":["Set sane positive limits in the server's capability configuration and validate at startup","Add a server-side startup assertion that advertised blob-pack limits are > 0","Test the capabilities endpoint after every server config change"],"tags":["remote-cache","configuration","limits"],"backgroundTag":"invalid-config-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}