{"record":{"id":"529197e17da5de09","repo":"influxdata/influxdb","slug":"invalid-content-type-header-0","errorCode":null,"errorMessage":"invalid content-type header: {0}","messagePattern":"invalid content-type header: (.+?)","errorType":"http","errorClass":"Error::NonUtf8ContentTypeHeader","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":208,"sourceCode":"    }\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\n    /// The client sent a request body that exceeds the configured maximum.\n    #[error(\"max request size ({0} bytes) exceeded\")]\n    RequestSizeExceeded(usize),\n","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L190-L226","documentation":"`Error::NonUtf8ContentTypeHeader` is returned when the `Content-Type` header value cannot be read as a string (wrapping `hyper::header::ToStrError`). Like all HTTP headers, it must be visible ASCII for the server to parse the MIME type.","triggerScenarios":"Sending a request whose `Content-Type` header contains non-ASCII bytes — e.g. UTF-8 characters in the media type, control characters, or a client building the header from unvalidated input.","commonSituations":"Custom HTTP clients inserting user-supplied or localized strings into Content-Type, misbehaving proxies, or template-generated requests where the content type string was interpolated incorrectly.","solutions":["Send a standard ASCII media type such as \"application/json\", \"text/plain\", or \"application/vnd.influxdb.v3+csv\"","Validate/sanitize any dynamic Content-Type value before inserting it into the request","Check the client or proxy producing the request for header corruption","Omit the header if the server can infer the type for the endpoint"],"exampleFix":"// before\nheaders.insert(\"Content-Type\", HeaderValue::from_bytes(format!(\"text/{}\", user_mime).as_bytes()).unwrap());\n// after\nheaders.insert(\"Content-Type\", HeaderValue::from_static(\"text/plain\"));","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['application/json','text/plain','application/vnd.influxdb.v3+csv']);\nif (!ALLOWED.has(contentType)) throw new Error('bad content-type: ' + contentType);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use standard media-type constants, not ad-hoc strings","Sanitize any dynamic Content-Type values","Check proxies don't rewrite headers","Document required content types per endpoint"],"tags":["http","headers","content-type"],"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"}