headroomlabs-ai/headroom · error · ValueError
Request body is brotli-compressed but the 'brotli' package i
Error message
Request body is brotli-compressed but the 'brotli' package is not installed.
What it means
Error "Request body is brotli-compressed but the 'brotli' package is not installed." thrown in headroomlabs-ai/headroom.
Source
Thrown at headroom/proxy/helpers.py:2432
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)
# ---------------------------------------------------------------------------
# Output-only content blocks
# ---------------------------------------------------------------------------
# The Anthropic *response* schema can emit signaling blocks that the *request*
# schema (messages[].content[]) does not accept. The primary case is the
# server-side refusal fallback notification introduced with the
# ``server-side-fallback-2026-06-01`` beta::
#View on GitHub (pinned to 322425c43b)
Solutions
- Install the brotli package: pip install brotli (or brotlicffi)
- Or ask the client to send the body with a supported encoding (identity/gzip)
- If you control the client, drop `Content-Encoding: br`
When it happens
Trigger: Raised when the proxy receives a request body with Content-Encoding: br but the optional `brotli` package is not installed.
Common situations: See trigger scenarios.
AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15).
Data as JSON: /api/errors/2a3d13ee7cd255c5.
Report an issue: GitHub.