{"record":{"id":"2a3d13ee7cd255c5","repo":"headroomlabs-ai/headroom","slug":"request-body-is-brotli-compressed-but-the-brotli","errorCode":null,"errorMessage":"Request body is brotli-compressed but the 'brotli' package is not installed.","messagePattern":"Request body is brotli-compressed but the 'brotli' package is not installed\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"headroom/proxy/helpers.py","lineNumber":2432,"sourceCode":"\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\n            raw = brotli.decompress(raw)\n        except ImportError:\n            raise ValueError(\n                \"Request body is brotli-compressed but the 'brotli' package is not installed.\"\n            ) from None\n        except Exception as exc:\n            raise ValueError(f\"Failed to decompress brotli request body: {exc}\") from exc\n    elif encoding and encoding != \"identity\":\n        raise ValueError(f\"Unsupported Content-Encoding: {encoding}\")\n\n    return cast(bytes, raw)\n\n\n# ---------------------------------------------------------------------------\n# Output-only content blocks\n# ---------------------------------------------------------------------------\n# The Anthropic *response* schema can emit signaling blocks that the *request*\n# schema (messages[].content[]) does not accept. The primary case is the\n# server-side refusal fallback notification introduced with the\n# ``server-side-fallback-2026-06-01`` beta::\n#","sourceCodeStart":2414,"sourceCodeEnd":2450,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/proxy/helpers.py#L2414-L2450","documentation":"Error \"Request body is brotli-compressed but the 'brotli' package is not installed.\" thrown in headroomlabs-ai/headroom.","triggerScenarios":"Raised when the proxy receives a request body with Content-Encoding: br but the optional `brotli` package is not installed.","commonSituations":"See trigger scenarios.","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`"],"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-15T17:31:12.345Z"}