{"record":{"id":"0449898e23f6dab6","repo":"influxdata/influxdb","slug":"invalid-content-encoding-header-0","errorCode":null,"errorMessage":"invalid content-encoding header: {0}","messagePattern":"invalid content-encoding header: (.+?)","errorType":"http","errorClass":"Error::NonUtf8ContentEncodingHeader","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":204,"sourceCode":"\nimpl From<ResourceAuthorizationError> for RoutingError {\n    fn from(e: ResourceAuthorizationError) -> Self {\n        Self::Authorization(e)\n    }\n}\n\n#[derive(Debug, Error)]\npub enum Error {\n    /// The requested path has no registered handler.\n    #[error(\"not found\")]\n    NoHandler,\n\n    /// The request body content is not valid utf8.\n    #[error(\"body content is not valid utf8: {0}\")]\n    NonUtf8Body(Utf8Error),\n\n    /// The `Content-Encoding` header is invalid and cannot be read.\n    #[error(\"invalid content-encoding header: {0}\")]\n    NonUtf8ContentEncodingHeader(hyper::header::ToStrError),\n\n    /// The `Content-Type` header is invalid and cannot be read.\n    #[error(\"invalid content-type header: {0}\")]\n    NonUtf8ContentTypeHeader(hyper::header::ToStrError),\n\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","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L186-L222","documentation":"`Error::NonUtf8ContentEncodingHeader` is returned when the `Content-Encoding` header value cannot be converted to a string (wrapping `hyper::header::ToStrError`). Header values must contain only visible ASCII; invalid bytes make the header unreadable.","triggerScenarios":"A client sends a `Content-Encoding` header containing non-ASCII/invalid bytes, e.g. raw UTF-8 characters, control characters, or a corrupted/malformed header produced by a custom HTTP client or proxy.","commonSituations":"Hand-rolled HTTP clients writing headers as raw bytes, misconfigured proxies mangling headers, or fuzz/ malicious clients sending non-ASCII header values.","solutions":["Inspect the outgoing request headers and ensure Content-Encoding contains only ASCII visible characters (e.g. \"gzip\", \"identity\")","Fix or replace the HTTP client/proxy that emits malformed headers","Remove the Content-Encoding header entirely if no encoding is actually applied","Test with curl to confirm the server accepts the same call and isolate the faulty client"],"exampleFix":"// before\nheaders.insert(\"Content-Encoding\", HeaderValue::from_bytes(b\"gzip – chunked\").unwrap());\n// after\nheaders.insert(\"Content-Encoding\", HeaderValue::from_static(\"gzip\"));","handlingStrategy":"validation","validationCode":"function validAsciiHeader(v) { return typeof v === 'string' && /^[\\x21-\\x7E]+$/.test(v); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set headers from static ASCII constants","Never interpolate free-form user text into header values","Validate headers in HTTP middleware before dispatch","Test with curl to rule out client-side header corruption"],"tags":["http","headers","encoding"],"backgroundTag":"invalid-argument-format","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"}