{"record":{"id":"aa286d6d5696aac7","repo":"influxdata/influxdb","slug":"the-mime-type-specified-was-not-valid-utf8-0","errorCode":null,"errorMessage":"the mime type specified was not valid UTF8: {0}","messagePattern":"the mime type specified was not valid UTF8: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":279,"sourceCode":"    ServingHttp(#[from] hyper::Error),\n\n    /// Missing parameters for query\n    #[error(\"missing query parameters 'db'\")]\n    MissingDeleteDatabaseParams,\n\n    /// Missing parameters for query\n    #[error(\"missing query parameters 'db' and 'q'\")]\n    MissingQueryParams,\n\n    /// Missing the `q` parameter in the v1 /query API\n    #[error(\"missing query parameter 'q'\")]\n    MissingQueryV1Params,\n\n    /// MIssing parameters for write\n    #[error(\"missing query parameter 'db'\")]\n    MissingWriteParams,\n\n    #[error(\"the mime type specified was not valid UTF8: {0}\")]\n    NonUtf8MimeType(#[from] FromUtf8Error),\n\n    /// Serde decode error\n    #[error(\"serde error: {0}\")]\n    SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),\n\n    /// Arrow error\n    #[error(\"arrow error: {0}\")]\n    Arrow(#[from] arrow::error::ArrowError),\n\n    /// Hyper error\n    #[error(\"hyper http error: {0}\")]\n    Hyper(#[from] hyper::http::Error),\n\n    /// WriteBuffer error\n    #[error(\"write buffer error: {0}\")]\n    WriteBuffer(#[from] influxdb3_write::write_buffer::Error),\n","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L261-L297","documentation":"Raised when an HTTP request's Content-Type (or similar) header value cannot be decoded as UTF-8. The header bytes are converted via String::from_utf8 and the resulting FromUtf8Error is wrapped by #[from]. It means the client sent header bytes that are not valid UTF-8, which the server refuses to interpret.","triggerScenarios":"Sending a Content-Type header containing raw non-UTF-8 bytes (e.g. Latin-1 encoded charset strings) to a write or query endpoint.","commonSituations":"Custom HTTP clients or old SDKs that encode header values in a legacy codepage; corrupted/mangled requests from misconfigured middleware.","solutions":["Send the Content-Type header as ASCII/UTF-8, e.g. 'text/plain' or 'application/json'","Inspect the raw request bytes (tcpdump/wireshark) for non-ASCII bytes in headers","Update or fix the client library that builds the request headers","Sanitize header values before sending: only printable ASCII is allowed"],"exampleFix":"// before\nreq.header(\"Content-Type\", \"text/plain; charset=ISO-8859-1\".encode(\"ISO-8859-1\"))\n// after\nreq.header(\"Content-Type\", \"text/plain; charset=utf-8\")","handlingStrategy":"type-guard","validationCode":"const ct = request.headers.get(\"content-type\") ?? \"\";\nif (!/^\\x20-\\x7E*$/.test(ct)) throw new Error(\"Content-Type must be printable ASCII\");","typeGuard":"function isAsciiHeader(v) { return typeof v === \"string\" && /^[\\x20-\\x7E]*$/.test(v); }","tryCatchPattern":"try { await send(req); } catch (e) {\n  if (String(e).includes(\"not valid UTF8\")) {\n    // re-encode all headers to ASCII and resend\n  }\n}","preventionTips":["Only set header values that are ASCII/UTF-8 strings","Base64-encode any header value that could contain binary data","Avoid charset conversion APIs when building headers","Lint client code for header assignments from decoded buffers"],"tags":["http","encoding","utf8","header"],"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"}