Content-Type troubleshooting
Content-Type header errors
A Content-Type header has one value: a media type such as application/json, optionally followed
by semicolon-separated parameters such as charset=utf-8. Most "invalid Content-Type" failures are
syntax errors in one of those two parts, and each part has its own fixes.
Start with the exact value
Copy the full header value, for example text/html; charset=utf-8, and paste it into
CorrectMIME. The validator reports the first structural problem with a code and a message. It checks the
string; it does not fetch a URL or inspect a file.
Choose your symptom
- Media type shape is wrong (missing slash, empty type or subtype, malformed suffix): Invalid MIME type
- Charset parameter is broken (missing semicolon, empty value, broken quotes, duplicates): Content-Type charset errors
- Any other parameter is broken (missing value or equals sign, bad quoting, invalid names): MIME / Content-Type parameter errors
- The multipart boundary parameter fails: multipart/form-data boundary errors
The parts of a Content-Type value
When an error message quotes a broken header, separate the header from the value first:
Content-Type: application/json; charset=utf-8
The failings live in the part after the colon. That value is two pieces of grammar: the media type
(application/json) and a parameter list (charset=utf-8). An error usually belongs
entirely to one piece:
- Media type errors affect the type, subtype, or structured suffix, and the whole value fails before parameters are even read.
- Parameter errors leave a valid media type but break the parameter list that follows the first semicolon.
The validator reports which piece failed and where: a missing slash is a media type error, while a parameter with no value is a parameter error. Correct the reported piece and re-check the whole value, because one preserved error can keep a strict receiver rejecting it.
Why the same header works in one place and fails in another
Receivers differ in how much they tolerate. A strict parser rejects a malformed Content-Type outright, which shows up as a refusal or a 4xx response. A lenient parser strips the broken parameter and proceeds, which is why the same header can pass one client and break another. The dangerous cases are the ambiguous ones: duplicates, where clients disagree about which value wins, and unquoted values containing spaces, where clients split parameters at different points.
Diagnosis workflow
- Copy the header value only, without the
Content-Type:field name. - Paste it into the Content-Type Validator and read the first reported issue.
- Open the matching guide above and apply the fix at the source: the serializer, template, or header constant that emitted the value.
- Re-validate the corrected value and confirm the report is clean or has only accepted warnings.
- Re-run the failing request or client against the new header.
What CorrectMIME checks
- Media type structure: type, subtype, and structured suffix tokens
- Parameter syntax: names, values, equals signs, semicolon separators, and quoting
- Duplicate parameters and empty parameter segments
- Warnings for unusually long values
The tool validates the header value in isolation. It does not look up the IANA registry, examine message bytes, or parse a full HTTP request or email.