{"record":{"id":"62aa9eae02678db8","repo":"headroomlabs-ai/headroom","slug":"request-body-is-zstd-compressed-but-the-zstandard","errorCode":null,"errorMessage":"Request body is zstd-compressed but the 'zstandard' package is not installed. Install it with: pip install zstandard","messagePattern":"Request body is zstd-compressed but the 'zstandard' package is not installed\\. Install it with: pip install zstandard","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"headroom/proxy/helpers.py","lineNumber":2406,"sourceCode":"    \"\"\"Read and (if needed) decompress the request body, returning raw UTF-8 bytes.\n\n    Mirrors ``_read_request_json`` but returns the bytes pre-parse so\n    forwarders can implement byte-faithful passthrough (PR-A3, fixes P0-2).\n    Raises ``ValueError`` on any decompression failure.\n    \"\"\"\n    encoding = (request.headers.get(\"content-encoding\") or \"\").lower().strip()\n    raw = await request.body()\n\n    if encoding in (\"zstd\", \"zstandard\"):\n        try:\n            import zstandard\n\n            dctx = zstandard.ZstdDecompressor()\n            reader = dctx.stream_reader(raw)\n            raw = reader.read()\n            reader.close()\n        except ImportError:\n            raise ValueError(\n                \"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:","sourceCodeStart":2388,"sourceCodeEnd":2424,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/proxy/helpers.py#L2388-L2424","documentation":"Error \"Request body is zstd-compressed but the 'zstandard' package is not installed. Install it with: pip install zstandard\" thrown in headroomlabs-ai/headroom.","triggerScenarios":"Raised when the proxy receives a request body with Content-Encoding: zstd but the optional `zstandard` package is not installed, so the body cannot be decompressed.","commonSituations":"See trigger scenarios.","solutions":["Install the zstandard package: pip install zstandard","Or ask the client to send the body uncompressed or with an encoding you support (identity/gzip)","If you control the client, remove `Content-Encoding: zstd` from the request"],"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-15T22:17:37.221Z"}