headroomlabs-ai/headroom · error · ValueError

Failed to decompress brotli request body: {exc}

Error message

Failed to decompress brotli request body: {exc}

What it means

Error "Failed to decompress brotli request body: {exc}" thrown in headroomlabs-ai/headroom.

Source

Thrown at headroom/proxy/helpers.py:2436

            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::
#
#     {"type": "fallback",
#      "from": {"model": "claude-fable-5"},
#      "to":   {"model": "claude-opus-4-8"}}
#

View on GitHub (pinned to 322425c43b)

Solutions

  1. Check the underlying exception {exc} — corrupt or truncated brotli data is typical
  2. Verify the client actually brotli-compressed the body
  3. Retry the request; if persistent, capture the raw body and test with the `brotli` CLI

When it happens

Trigger: Raised when decompressing a brotli-compressed request body fails, typically due to corruption or mislabeled content encoding.

Common situations: See trigger scenarios.


AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15). Data as JSON: /api/errors/c7a5fbb1a227df1a. Report an issue: GitHub.