{"record":{"id":"972650d41c1b2707","repo":"headroomlabs-ai/headroom","slug":"failed-to-decompress-deflate-request-body-exc","errorCode":null,"errorMessage":"Failed to decompress deflate request body: {exc}","messagePattern":"Failed to decompress deflate request body: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"headroom/proxy/helpers.py","lineNumber":2425,"sourceCode":"                \"Request body is zstd-compressed but the 'zstandard' package is not installed. \"\n                \"Install it with: pip install zstandard\"\n            ) from None\n        except Exception as exc:\n            raise ValueError(f\"Failed to decompress zstd request body: {exc}\") from exc\n    elif encoding == \"gzip\":\n        import gzip as _gzip\n\n        try:\n            raw = _gzip.decompress(raw)\n        except Exception as exc:\n            raise ValueError(f\"Failed to decompress gzip request body: {exc}\") from exc\n    elif encoding == \"deflate\":\n        import zlib\n\n        try:\n            raw = zlib.decompress(raw)\n        except Exception as exc:\n            raise ValueError(f\"Failed to decompress deflate request body: {exc}\") from exc\n    elif encoding == \"br\":\n        try:\n            import brotli\n\n            raw = brotli.decompress(raw)\n        except ImportError:\n            raise ValueError(\n                \"Request body is brotli-compressed but the 'brotli' package is not installed.\"\n            ) from None\n        except Exception as exc:\n            raise ValueError(f\"Failed to decompress brotli request body: {exc}\") from exc\n    elif encoding and encoding != \"identity\":\n        raise ValueError(f\"Unsupported Content-Encoding: {encoding}\")\n\n    return cast(bytes, raw)\n\n\n# ---------------------------------------------------------------------------","sourceCodeStart":2407,"sourceCodeEnd":2443,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/proxy/helpers.py#L2407-L2443","documentation":"Error \"Failed to decompress deflate request body: {exc}\" thrown in headroomlabs-ai/headroom.","triggerScenarios":"Raised when inflating a deflate-compressed request body fails, usually a corrupt payload or zlib-vs-raw-deflate mismatch.","commonSituations":"See trigger scenarios.","solutions":["Inspect the underlying exception {exc}; truncated deflate streams are the common cause","Confirm the client truly sent deflate-compressed data (some clients mislabel zlib-wrapped vs raw deflate)","Retry the request; capture and inspect the raw body if it persists"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}