{"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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/lib.rs","lineNumber":548,"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":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/crates/mise-cache-core/src/lib.rs#L530-L566","documentation":"Thrown while parsing server capabilities (crates/mise-cache-core/src/lib.rs:548): the server advertises features.blob_packs but sets limits.max_pack_bytes == 0. A zero byte limit would make every pack request invalid, so the client treats it as a misconfiguration rather than a usable limit. (Compare the sibling check at lib.rs:541 requiring max_batch_items to be positive.)","triggerScenarios":"The capabilities endpoint returns {\"features\":{\"blob_packs\":true},\"limits\":{\"max_batch_items\":N,\"max_pack_bytes\":0}}. Typical for a half-configured or custom cache server that enables the feature flag but leaves the size limit unset/defaulted to zero.","commonSituations":"Server-side config omission (limit field not set, serde default 0); a server template/example copied with the limits block empty; version skew where the field name changed and serde deserialized the default.","solutions":["If you operate the server, set a positive max_pack_bytes limit in the capabilities response (the client will additionally clamp it to MAX_STAGED_BLOB_PACK_BYTES = 256 MiB)","If the server cannot serve packs correctly, disable the feature: features.blob_packs = false — the client then returns Ok(None) and uses per-blob downloads","If you do not control the server, report the misconfiguration; the client intentionally refuses rather than send packs it knows will be rejected"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"let caps: RemoteCacheCapabilities = fetch_capabilities(&url).await?;\nlet packs_usable = caps.features.blob_packs\n    && caps.limits.max_batch_items > 0\n    && caps.limits.max_pack_bytes > 0;\nif !packs_usable { /* use per-blob path from the start */ }","typeGuard":"fn blob_packs_configured(c: &RemoteCacheCapabilities) -> bool {\n    c.features.blob_packs && c.limits.max_batch_items > 0 && c.limits.max_pack_bytes > 0\n}","tryCatchPattern":"if !blob_packs_configured(&caps) { client.disable_blob_packs(); }\n// subsequent pack calls are avoided entirely; per-blob GETs are used","preventionTips":["Validate the capabilities document in your server's test suite: enabling blob_packs obligates positive limits","Default limits to concrete values server-side rather than serde defaults of 0","Smoke-test client+server pairs on version bumps"],"tags":["mise","cache","configuration","capabilities","blob-pack"],"backgroundTag":"server-misconfiguration","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}