jdx/mise · error
remote cache blob pack has an invalid content type
Error message
remote cache blob pack has an invalid content type
What it means
When downloading a blob pack, the client checks the response's Content-Type media type and requires it to be the expected BLOB_PACK_MEDIA_TYPE. Any other content type (including a missing header or one prefixed with unexpected parameters) is rejected before decoding begins. This guards against a proxy or misconfigured server returning HTML error pages or JSON in place of the pack.
Solutions
- Check what the endpoint actually returned (curl -i with the same headers) to see the offending content type
- Fix the reverse proxy/CDN so it passes the blob-pack endpoint through unmodified
- Upgrade or fix the cache server so successful pack responses carry the correct Content-Type
- Verify the client is hitting the correct v{N}/blobs:pack endpoint, not an error route
Defensive patterns
Strategy: try-catch
Validate before calling
let resp = client.post(pack_url)
.header(CONTENT_TYPE, DIGEST_LIST_MEDIA_TYPE)
.body(body)
.send().await?;
let ct = resp.headers().get(CONTENT_TYPE).and_then(|v| v.to_str().ok());
if ct.map(|c| !c.starts_with(BLOB_PACK_MEDIA_TYPE)).unwrap_or(true) {
bail!("endpoint returned non-pack content type: {:?}", ct);
} Try / catch
match client.get_blob_pack(&digests, staging).await {
Err(e) if e.to_string().contains("invalid content type") => {
// proxy/server misconfiguration; fall back to per-blob downloads
}
other => other?,
} Prevention
- Exclude the cache endpoints from auth proxies/CDNs that rewrite Content-Type
- Add an integration test asserting the pack response Content-Type
- Check response headers with curl -i after proxy or server config changes
When it happens
Trigger: POSTing the digest list to the blobs:pack endpoint and receiving a 200 response whose Content-Type is not the blob-pack media type (e.g. application/json, text/html from an auth proxy, or a truncated/parameterized header).
Common situations: An auth proxy or CDN intercepting the request and returning an HTML login/error page with 200; a server that supports the endpoint but responds with the wrong media type; content-type sniffing middleware rewriting headers.
Related errors
- Got HTML instead of text from
- Got non-HTML text from
- attestation requests must not have a streaming body
- blob chunk upload failed
- blob upload failed
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/43dfa84444234864.
Report an issue: GitHub.
Appendix: source
Thrown at crates/mise-cache-core/src/lib.rs:596
.send()
.await?;
if matches!(
response.status(),
StatusCode::NOT_FOUND
| StatusCode::METHOD_NOT_ALLOWED
| StatusCode::NOT_IMPLEMENTED
) {
return Ok(None);
}
let response = response.error_for_status()?;
let media_type = response
.headers()
.get(CONTENT_TYPE)
.and_then(|value| value.to_str().ok())
.and_then(|value| value.split(';').next())
.map(str::trim);
if media_type != Some(BLOB_PACK_MEDIA_TYPE) {
bail!("remote cache blob pack has an invalid content type");
}
Ok(Some(
decode_blob_pack(response, digests, staging_dir).await?,
))
});
tokio::time::timeout(download_timeout, download)
.await
.map_err(|_| eyre!("remote cache blob pack download timed out for {url}"))?
}
pub async fn get_action_result(
&self,
action: &CacheDigest,
) -> Result<Option<RemoteActionResult>> {
let url = self.action_result_endpoint(action)?;
let result = retry_async("GET", &url, self.retries, || async {
let response = self
.request(reqwest::Method::GET, url.clone(), ACTION_RESULT_MEDIA_TYPE)View on GitHub (pinned to 533346cc37)