headroomlabs-ai/headroom · error · ValueError
Failed to decompress deflate request body: {exc}
Error message
Failed to decompress deflate request body: {exc} What it means
Error "Failed to decompress deflate request body: {exc}" thrown in headroomlabs-ai/headroom.
Source
Thrown at headroom/proxy/helpers.py:2425
"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
raw = brotli.decompress(raw)
except ImportError:
raise ValueError(
"Request body is brotli-compressed but the 'brotli' package is not installed."
) from None
except Exception as exc:
raise ValueError(f"Failed to decompress brotli request body: {exc}") from exc
elif encoding and encoding != "identity":
raise ValueError(f"Unsupported Content-Encoding: {encoding}")
return cast(bytes, raw)
# ---------------------------------------------------------------------------View on GitHub (pinned to 322425c43b)
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
When it happens
Trigger: Raised when inflating a deflate-compressed request body fails, usually a corrupt payload or zlib-vs-raw-deflate mismatch.
Common situations: See trigger scenarios.
AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15).
Data as JSON: /api/errors/972650d41c1b2707.
Report an issue: GitHub.