headroomlabs-ai/headroom · error · ValueError
Failed to decompress zstd request body: {exc}
Error message
Failed to decompress zstd request body: {exc} What it means
Error "Failed to decompress zstd request body: {exc}" thrown in headroomlabs-ai/headroom.
Source
Thrown at headroom/proxy/helpers.py:2411
"""
encoding = (request.headers.get("content-encoding") or "").lower().strip()
raw = await request.body()
if encoding in ("zstd", "zstandard"):
try:
import zstandard
dctx = zstandard.ZstdDecompressor()
reader = dctx.stream_reader(raw)
raw = reader.read()
reader.close()
except ImportError:
raise ValueError(
"Request body is zstd-compressed but the 'zstandard' package is not installed. "
"Install it with: pip install zstandard"
) from None
except Exception as exc:
raise ValueError(f"Failed to decompress zstd request body: {exc}") from exc
elif encoding == "gzip":
import gzip as _gzip
try:
raw = _gzip.decompress(raw)
except Exception as exc:
raise ValueError(f"Failed to decompress gzip request body: {exc}") from exc
elif encoding == "deflate":
import zlib
try:
raw = zlib.decompress(raw)
except Exception as exc:
raise ValueError(f"Failed to decompress deflate request body: {exc}") from exc
elif encoding == "br":
try:
import brotli
View on GitHub (pinned to 322425c43b)
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
When it happens
Trigger: Raised when decompressing a zstd-compressed request body fails, typically due to a corrupt/truncated payload or a client mislabeling the content encoding.
Common situations: See trigger scenarios.
AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15).
Data as JSON: /api/errors/102738a888d8fa4a.
Report an issue: GitHub.