influxdata/influxdb · error · Error::InvalidContentEncoding
unacceptable content-encoding
Error message
unacceptable content-encoding: {0} What it means
`Error::InvalidContentEncoding` is returned when the request's `Content-Encoding` value is readable but not an encoding the server accepts (it embeds the offending value). The server only decodes a small allowlist, chiefly gzip, and treats the body as-is otherwise.
Solutions
- Compress the body with gzip and set `Content-Encoding: gzip`, or send it uncompressed without the header
- Disable brotli/deflate/zstd compression in your HTTP client for this request
- Fix the header spelling — the value must match exactly what the server accepts
- Check intermediate proxies that might re-encode the payload
Example fix
// before
headers.set('Content-Encoding', 'br');
// after
import zlib from 'zlib';
const body = zlib.gzipSync(payload);
headers.set('Content-Encoding', 'gzip'); Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_ENCODINGS = new Set(['gzip','identity']);
if (contentEncoding && !SUPPORTED_ENCODINGS.has(contentEncoding)) throw new Error('unsupported encoding: ' + contentEncoding); Try / catch
try { await send(); } catch (e) { if (String(e).includes('unacceptable content-encoding')) { await sendUncompressed(); } else throw e; } Prevention
- Only declare Content-Encoding: gzip when you actually gzip the body
- Disable brotli/zstd defaults in HTTP clients for this API
- Send identity/uncompressed unless the server documents other encodings
- Check CDN/proxy compression settings
When it happens
Trigger: Sending a body compressed or labelled with an unsupported encoding, e.g. `Content-Encoding: br`, `deflate`, `zstd`, or a misspelled value like `gzipp`, while the server only handles gzip/identity.
Common situations: HTTP clients with default compression (brotli) enabled, servers/CDN layers adding zstd compression, or hand-written clients that set the header but use a different algorithm than declared.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- error decoding gzip stream
- arrow error
- Authorization header was malformed, the request was not in…
- body content is not valid utf8
- Cannot parse the given human time
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/0585b2ecab37f70e.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_server/src/http.rs:212
pub enum Error {
/// The requested path has no registered handler.
#[error("not found")]
NoHandler,
/// The request body content is not valid utf8.
#[error("body content is not valid utf8: {0}")]
NonUtf8Body(Utf8Error),
/// The `Content-Encoding` header is invalid and cannot be read.
#[error("invalid content-encoding header: {0}")]
NonUtf8ContentEncodingHeader(hyper::header::ToStrError),
/// The `Content-Type` header is invalid and cannot be read.
#[error("invalid content-type header: {0}")]
NonUtf8ContentTypeHeader(hyper::header::ToStrError),
/// The specified `Content-Encoding` is not acceptable.
#[error("unacceptable content-encoding: {0}")]
InvalidContentEncoding(String),
/// The specified `Content-Type` is not acceptable.
#[error("unacceptable content-type, expected: {expected}")]
InvalidContentType { expected: mime::Mime },
/// The client disconnected.
#[error("client disconnected")]
ClientHangup(Box<dyn std::error::Error + Send + Sync>),
/// The client sent a request body that exceeds the configured maximum.
#[error("max request size ({0} bytes) exceeded")]
RequestSizeExceeded(usize),
/// Decoding a gzip-compressed stream of data failed.
#[error("error decoding gzip stream: {0}")]
InvalidGzip(std::io::Error),
View on GitHub (pinned to 06200ef96b)