{"record":{"id":"4fc086de46f14df8","repo":"headroomlabs-ai/headroom","slug":"ccr-backend-backend-is-not-compiled-in-rebuil","errorCode":null,"errorMessage":"ccr backend `{backend}` is not compiled in; rebuild with `--features {feature}` or pick a different backend","messagePattern":"ccr backend `(.+?)` is not compiled in; rebuild with `--features (.+?)` or pick a different backend","errorType":"exception","errorClass":"CcrBackendInitError","httpStatus":null,"severity":"error","filePath":"crates/headroom-core/src/ccr/backends/mod.rs","lineNumber":76,"sourceCode":"        }\n    }\n}\n\n/// Reasons `from_config` may fail. Each variant is loud and recoverable\n/// at the proxy startup boundary — the operator is told exactly what\n/// went wrong rather than silently degrading to in-memory.\n#[derive(Debug, Error)]\npub enum CcrBackendInitError {\n    /// SQLite open / schema-create failed.\n    #[error(\"ccr sqlite backend init failed: {0}\")]\n    Sqlite(#[from] rusqlite::Error),\n    /// Redis open / PING failed (the smoke-test in `RedisCcrStore::open`).\n    #[cfg(feature = \"redis\")]\n    #[error(\"ccr redis backend init failed: {0}\")]\n    Redis(::redis::RedisError),\n    /// Operator selected a backend whose feature flag was not compiled\n    /// in. Loud failure rather than silent fallback.\n    #[error(\n        \"ccr backend `{backend}` is not compiled in; rebuild with `--features {feature}` \\\n         or pick a different backend\"\n    )]\n    UnsupportedBackend {\n        backend: &'static str,\n        feature: &'static str,\n    },\n}\n\n#[cfg(feature = \"redis\")]\nimpl From<::redis::RedisError> for CcrBackendInitError {\n    fn from(err: ::redis::RedisError) -> Self {\n        Self::Redis(err)\n    }\n}\n\n/// Construct a CCR backend from `config`. Errors surface — never falls\n/// back silently. A successful return guarantees the backend has","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/crates/headroom-core/src/ccr/backends/mod.rs#L58-L94","documentation":"The request declared 'Content-Encoding: gzip' but gzip.decompress() raised — the body is not valid gzip data (helpers.py:2418). Typical underlying errors are gzip.BadGzipFile ('Not a gzipped file') or EOFError from a truncated stream.","triggerScenarios":"Sending a plain or deflate-compressed body with a 'Content-Encoding: gzip' header; chunked upload interrupted mid-body so the gzip trailer is missing; a front proxy stripped the gzip encoding but kept the header.","commonSituations":"Mismatches between encoding label and actual bytes; retry middleware that re-reads a consumed/short body stream; test harnesses that hand-craft bodies with copy-pasted headers.","solutions":["Verify the raw body with: python -c \"import gzip; gzip.decompress(open('body.bin','rb').read())\"","Make the client actually gzip the payload (e.g. requests with a prepared request whose body is gzip.compress(data)) whenever it sets the gzip header","Strip or correct Content-Encoding on any gateway that rewrites request bodies before headroom"],"exampleFix":"# before\nheaders = {\"Content-Encoding\": \"gzip\"}\nrequests.post(url, data=json.dumps(payload).encode(), headers=headers)\n\n# after\nheaders = {\"Content-Encoding\": \"gzip\"}\nrequests.post(url, data=gzip.compress(json.dumps(payload).encode()), headers=headers)","handlingStrategy":"try-catch","validationCode":"import gzip\ntry:\n    gzip.decompress(compressed_body)\nexcept Exception:\n    raise RuntimeError(\"payload is not valid gzip — refusing to send\")","typeGuard":null,"tryCatchPattern":"try:\n    body = await _read_request_body_bytes(request)\nexcept ValueError as exc:\n    return JSONResponse({\"error\": {\"message\": str(exc)}}, status_code=400)","preventionTips":["Set the header from the same code that performs the compression","Use requests-toolbelt or a session hook so encoding and header stay in sync","Integration-test the compressed path, not just plain bodies"],"tags":["compression","gzip","corrupt-body","request-body"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}