{"record":{"id":"102738a888d8fa4a","repo":"headroomlabs-ai/headroom","slug":"failed-to-decompress-zstd-request-body-exc","errorCode":null,"errorMessage":"Failed to decompress zstd request body: {exc}","messagePattern":"Failed to decompress zstd request body: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"headroom/proxy/helpers.py","lineNumber":2411,"sourceCode":"    \"\"\"\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:\n            raise ValueError(f\"Failed to decompress deflate request body: {exc}\") from exc\n    elif encoding == \"br\":\n        try:\n            import brotli\n","sourceCodeStart":2393,"sourceCodeEnd":2429,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/proxy/helpers.py#L2393-L2429","documentation":"Error \"Failed to decompress zstd request body: {exc}\" thrown in headroomlabs-ai/headroom.","triggerScenarios":"Raised when decompressing a zstd-compressed request body fails, typically due to a corrupt/truncated payload or a client mislabeling the content encoding.","commonSituations":"See trigger scenarios.","solutions":["Check the underlying exception {exc}: a corrupt or truncated zstd frame usually means a buggy client or a man-in-the-middle","Verify the client is actually sending zstd (not mislabeled content)","Retry the request; transient truncation during upload can corrupt the stream","If reproducible, capture the raw body and validate it with the `zstd` CLI"],"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"}