{"record":{"id":"ea667d65bcfa8801","repo":"influxdata/influxdb","slug":"invalid-mime-type-0-ea667d","errorCode":null,"errorMessage":"invalid mime type ({0})","messagePattern":"invalid mime type \\((.+?)\\)","errorType":"validation","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"influxdb3_types/src/http.rs","lineNumber":60,"sourceCode":"\nimpl<'a> serde::Deserialize<'a> for HardDeletionTime {\n    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>\n    where\n        D: serde::Deserializer<'a>,\n    {\n        let s = String::deserialize(deserializer)?;\n        match s.as_str() {\n            \"never\" => Ok(Self::Never),\n            \"now\" => Ok(Self::Now),\n            \"default\" => Ok(Self::Default),\n            timestamp => Ok(Self::Timestamp(timestamp.to_string())),\n        }\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(\"invalid mime type ({0})\")]\n    InvalidMimeType(String),\n\n    #[error(\"the mime type specified was not valid UTF8: {0}\")]\n    NonUtf8MimeType(#[from] std::string::FromUtf8Error),\n\n    #[error(transparent)]\n    Unexpected(#[from] anyhow::Error),\n}\n\nimpl From<&Error> for hyper::StatusCode {\n    fn from(value: &Error) -> Self {\n        match value {\n            Error::InvalidMimeType(_) | Error::NonUtf8MimeType(_) => Self::BAD_REQUEST,\n            Error::Unexpected(_) => Self::INTERNAL_SERVER_ERROR,\n        }\n    }\n}\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_types/src/http.rs#L42-L78","documentation":"Error::InvalidMimeType in influxdb3_types::http is thrown when a supplied MIME/media type string cannot be parsed as a valid mime type. The offending string is included in the message. It guards HTTP request/response handling where a known Content-Type must be resolved.","triggerScenarios":"Passing an unparsable Content-Type or Accept string to the HTTP type conversion/parsing code in influxdb3_types::http, e.g. malformed values like \"text/\" or \"foo;bar=\".","commonSituations":"Manually constructed headers, proxies or clients sending unusual Content-Type values, typo'd media types in configuration, tests hardcoding fake mime strings.","solutions":["Fix the media type string to a valid value such as \"application/json\" or \"text/csv\"","Strip malformed parameters and re-send a canonical Content-Type header","Inspect the value in parentheses in the message to find which header value was rejected"],"exampleFix":"// before\nlet mime: Mime = \"text/\".parse()?; // invalid\n// after\nlet mime: Mime = \"application/json\".parse()?;","handlingStrategy":"validation","validationCode":"fn is_valid_mime(s: &str) -> bool {\n    s.parse::<mime::Mime>().is_ok()\n}","typeGuard":"fn as_valid_mime(s: &str) -> Option<mime::Mime> {\n    s.parse::<mime::Mime>().ok()\n}","tryCatchPattern":"match result {\n    Ok(v) => v,\n    Err(e) if e.to_string().contains(\"invalid mime type\") => /* reject request with 400 */,\n    Err(e) => return Err(e),\n}","preventionTips":["Use a mime parsing library instead of ad-hoc string handling","Send canonical Content-Type values from clients","Test header handling with odd client values"],"tags":["http","mime","validation"],"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"}