influxdata/influxdb · error · Error
invalid mime type ( )
Error message
invalid mime type ({0}) What it means
`Error::InvalidMimeType` is returned when a MIME type string supplied with the request (typically the Content-Type value) cannot be parsed into a valid `mime::Mime`. Unlike the NonUtf8 header errors, the string is readable but malformed as a media type.
Solutions
- Use a well-formed media type string such as "text/plain", "application/json", or "application/vnd.influxdb.v3+csv"
- Validate the configured content type in your client with a MIME parser before sending
- Remove stray parameters/whitespace/semicolons from the header value
- Let your HTTP library set the default Content-Type instead of overriding it with a custom string
Example fix
// before
headers.set('Content-Type', 'text');
// after
headers.set('Content-Type', 'text/plain'); Defensive patterns
Strategy: validation
Validate before calling
const MIME_RE = /^[\w.+-]+\/[\w.+-]+(\s*;.*)?$/;
if (!MIME_RE.test(contentType)) throw new Error('malformed content-type: ' + contentType); Prevention
- Only use well-known media-type strings for Content-Type
- Validate MIME strings with a parser before configuring clients
- Avoid interpolating user/config values into Content-Type
- Prefer library defaults over hand-built header strings
When it happens
Trigger: Passing Content-Type values like "text", "plain-text/lp; ;", or other strings that fail MIME parsing; the offending value is embedded in the message.
Common situations: Hand-typed or interpolated Content-Type headers with typos, missing subtype ("application"), stray semicolons/parameters, or clients constructing the header from user configuration.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- unacceptable content-type, expected
- invalid content-type header
- invalid mime type ( )
- invalid mime type ( )
- the mime type specified was not valid UTF8
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/881b37a062552286.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_server/src/http.rs:231
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),
#[error("invalid mime type ({0})")]
InvalidMimeType(String),
/// DatabaseName validation error.
#[error("error validating database name: {0}")]
InvalidDatabaseName(#[from] DatabaseNameError),
/// Failure to decode the provided line protocol.
#[error("failed to parse line protocol: {0}")]
ParseLineProtocol(influxdb_line_protocol::Error),
/// The router is currently servicing the maximum permitted number of
/// simultaneous requests.
#[error("this service is overloaded, please try again later")]
RequestLimit,
/// The request has no authentication, but authorization is configured.
#[error("authentication required")]
Unauthenticated,View on GitHub (pinned to 06200ef96b)