{"record":{"id":"af818ed7b03cd326","repo":"wasmerio/wasmer","slug":"unsupported-content-encoding-other","errorCode":null,"errorMessage":"unsupported content-encoding: {other}","messagePattern":"unsupported content-encoding: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/wasix/src/runtime/package_loader/builtin_loader.rs","lineNumber":398,"sourceCode":"                    reader = Box::new(flate2::read::GzDecoder::new(reader));\n                }\n                \"zstd\" => {\n                    #[cfg(not(target_arch = \"wasm32\"))]\n                    {\n                        reader = Box::new(\n                            zstd::stream::read::Decoder::new(reader)\n                                .context(\"failed to initialize zstd decoder\")?,\n                        );\n                    }\n                    #[cfg(target_arch = \"wasm32\")]\n                    {\n                        // NOTE: in browsers this code will not be hit because\n                        // the fetch API automatically handles content decoding.\n                        bail!(\"zstd content-encoding is not supported on wasm32\");\n                    }\n                }\n                \"identity\" => {}\n                other => bail!(\"unsupported content-encoding: {other}\"),\n            }\n        }\n\n        let mut decoded = Vec::new();\n        reader\n            .read_to_end(&mut decoded)\n            .context(\"failed to decode response body\")?;\n        Ok(decoded)\n    }\n}\n\nimpl Default for BuiltinPackageLoader {\n    fn default() -> Self {\n        BuiltinPackageLoader::new()\n    }\n}\n\n#[async_trait::async_trait]","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/runtime/package_loader/builtin_loader.rs#L380-L416","documentation":"decode_response_body accepts only a known set of Content-Encoding values (gzip, deflate/br/zstd variants, and 'identity'); any other encoding token reaches the catch-all arm and aborts the package download. The library refuses to guess how to decode an encoding it doesn't implement.","triggerScenarios":"A registry, mirror, or proxy responds to a package fetch with an exotic Content-Encoding header — e.g. 'zstd-raw', 'lz4', 'br; q=1' malformed values, double encodings like 'gzip, br', or a typo'd custom token — while builtin_loader streams the body.","commonSituations":"Corporate proxies / security appliances injecting encoding; misconfigured CDN transform rules; custom Rust-based registry emitting a novel encoding; HTTP middleware stacking multiple encodings into one header.","solutions":["Inspect the response's Content-Encoding header value and fix the server/proxy to send an encoding the loader supports (gzip, zstd, br, or identity — ideally just 'identity' for package downloads)","Disable content-transform/compression middleware for the registry endpoint (e.g. CDN 'auto-compress' off, proxy response-encoding filter bypassed)","Ensure only a single encoding token is sent — if the origin plus proxy each compress, disable one layer to avoid 'gzip, br' style values","As a client workaround, point the loader at a mirror that serves uncompressed (Content-Encoding: identity) package artifacts"],"exampleFix":"// before: proxy stacking encodings\n// Content-Encoding: gzip, br  -> bail! unsupported\n// after: single pass at the edge\n// Content-Encoding: identity (or gzip only)\n// nginx:\n// gzip off;  # origin already serves plain artifacts","handlingStrategy":"try-catch","validationCode":"// validate encoding before handing the response to the loader\nfn validate_content_encoding(header: Option<&str>) -> Result<(), String> {\n    const KNOWN: &[&str] = &[\n        \"identity\", \"gzip\", \"x-gzip\", \"deflate\", \"br\", \"zstd\",\n    ];\n    let enc = header.unwrap_or(\"identity\");\n    if enc.contains(',') {\n        return Err(format!(\"stacked content-encoding not supported: {enc}\"));\n    }\n    if !KNOWN.contains(&enc.trim().to_ascii_lowercase().as_str()) {\n        return Err(format!(\"unsupported content-encoding: {enc}\"));\n    }\n    Ok(())\n}","typeGuard":"fn is_supported_encoding(header: Option<&str>) -> bool {\n    const KNOWN: &[&str] = &[\n        \"identity\", \"gzip\", \"x-gzip\", \"deflate\", \"br\", \"zstd\",\n    ];\n    let enc = header.unwrap_or(\"identity\").trim();\n    !enc.contains(',') && KNOWN.contains(&enc.to_ascii_lowercase().as_str())\n}","tryCatchPattern":"match loader.download_and_decode(url).await {\n    Ok(pkg) => Ok(pkg),\n    Err(e) if e.to_string().starts_with(\"unsupported content-encoding:\") => {\n        log::warn!(\"{e}; retrying via uncompressed mirror\");\n        loader.download_and_decode(identity_mirror_url(url)).await\n    }\n    Err(e) => Err(e.into()),\n}","preventionTips":["Disable content-transform/compression middleware for package registry endpoints so responses go out identity-encoded","Keep the encoding chain to a single hop — never let origin and proxy both compress","Pin package downloads to mirrors you control and audit their response headers (curl -sI) in CI","Handle 'Content-Encoding' with parameters/stacked tokens explicitly at your HTTP layer before it reaches the loader"],"tags":["http","content-encoding","package-loader","network","wasix"],"backgroundTag":"unsupported-content-encoding","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}