{"record":{"id":"705a46803a72033a","repo":"influxdata/influxdb","slug":"error-decoding-gzip-stream-0","errorCode":null,"errorMessage":"error decoding gzip stream: {0}","messagePattern":"error decoding gzip stream: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":228,"sourceCode":"\n    /// The specified `Content-Encoding` is not acceptable.\n    #[error(\"unacceptable content-encoding: {0}\")]\n    InvalidContentEncoding(String),\n\n    /// The specified `Content-Type` is not acceptable.\n    #[error(\"unacceptable content-type, expected: {expected}\")]\n    InvalidContentType { expected: mime::Mime },\n\n    /// The client disconnected.\n    #[error(\"client disconnected\")]\n    ClientHangup(Box<dyn std::error::Error + Send + Sync>),\n\n    /// The client sent a request body that exceeds the configured maximum.\n    #[error(\"max request size ({0} bytes) exceeded\")]\n    RequestSizeExceeded(usize),\n\n    /// Decoding a gzip-compressed stream of data failed.\n    #[error(\"error decoding gzip stream: {0}\")]\n    InvalidGzip(std::io::Error),\n\n    #[error(\"invalid mime type ({0})\")]\n    InvalidMimeType(String),\n\n    /// DatabaseName validation error.\n    #[error(\"error validating database name: {0}\")]\n    InvalidDatabaseName(#[from] DatabaseNameError),\n\n    /// Failure to decode the provided line protocol.\n    #[error(\"failed to parse line protocol: {0}\")]\n    ParseLineProtocol(influxdb_line_protocol::Error),\n\n    /// The router is currently servicing the maximum permitted number of\n    /// simultaneous requests.\n    #[error(\"this service is overloaded, please try again later\")]\n    RequestLimit,\n","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L210-L246","documentation":"`Error::InvalidGzip` is raised when decoding a gzip-compressed request body fails; the underlying `std::io::Error` from the gzip decoder is embedded in the message. The server streams the body through a gzip decoder when `Content-Encoding: gzip` is declared, and corrupt input aborts that stream.","triggerScenarios":"Sending a body labelled `Content-Encoding: gzip` that is not valid gzip data — e.g. truncated files, double-compressed payloads, a header saying gzip while the body is raw or brotli, or corruption in transit.","commonSituations":"Clients that set the gzip header without actually compressing, proxies that decompress but leave the header, partially-uploaded files, or double-compression bugs in producer code.","solutions":["Verify the body actually decodes as gzip before sending (gunzip -t file) and that the header matches the real encoding","Ensure the client compresses the body exactly once and only sets Content-Encoding: gzip when it does","Re-send the payload if it was truncated mid-upload; add checksums/retries for large transfers","Bypass intermediaries that may modify the body and test with a direct curl request"],"exampleFix":"// before\nheaders.set('Content-Encoding', 'gzip');\nfetch(url, { method: 'POST', body: rawPayload }); // not actually compressed\n// after\nimport zlib from 'zlib';\nheaders.set('Content-Encoding', 'gzip');\nfetch(url, { method: 'POST', body: zlib.gzipSync(rawPayload) });","handlingStrategy":"validation","validationCode":"function isGzip(buf) { return buf[0] === 0x1f && buf[1] === 0x8b; }\nif (headers['content-encoding'] === 'gzip' && !isGzip(body)) throw new Error('body is not gzip but header says gzip');","typeGuard":"function gzipHeaderMatches(body, enc) { return enc !== 'gzip' || isGzip(body); }","tryCatchPattern":"try { await sendCompressed(); } catch (e) { if (String(e).includes('decoding gzip')) { await sendUncompressed(); } else throw e; }","preventionTips":["Verify gzip integrity (magic bytes 1f 8b, gunzip -t) before sending","Compress exactly once; don't double-compress or leave stale headers","Add retries/checksums for large uploads to avoid truncation","Bypass intermediaries when debugging body corruption"],"tags":["http","gzip","compression","corrupt-data"],"backgroundTag":"checksum-mismatch","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}