Slack error invalid_charset: Invalid charset in Content-Type header
Last verified against Slack API reference - chat.postMessage errors
The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.What error invalid_charset means
Your POST carried a Content-Type header with a charset parameter Slack does not accept. The documented list of valid charset names is short: utf-8 and iso-8859-1. Anything else in that slot fails the request before any argument is read.
Nobody writes a bad charset on purpose, so this almost always comes from a library default or a copy-pasted header. Common sources are HTTP clients on older runtimes that append a platform encoding, proxies or API gateways that rewrite headers, and hand-written values with typos such as charset=utf8 or a quoted charset="UTF-8" that a strict parser may not normalize.
Your token, channel and message are not the problem. Fix the header and the identical body will go through. Since Slack's JSON guidance already expects UTF-8 text, application/json; charset=utf-8 is the safe value to standardize on.
What it looks like
POST /api/chat.postMessage
Content-type: application/json; charset=windows-1252
{"ok": false, "error": "invalid_charset"}Why it happens
- An HTTP library appended a non-UTF-8 platform default charset to the Content-Type header.
- A proxy, gateway or middleware rewrote the header on the way out.
- A typo or variant spelling in a hand-written header value.
- A charset was copied from a different API integration's request template.
How to fix Slack error invalid_charset
- 1Log the outgoing Content-Type header exactly as sent, after any middleware.
- 2Set it explicitly to application/json; charset=utf-8 (or application/x-www-form-urlencoded; charset=utf-8 for form bodies).
- 3Make sure the body bytes really are UTF-8 so the declared charset is truthful.
- 4If a proxy is involved, send one request directly to slack.com to confirm the proxy is the source.
How to stop it recurring
Pin the Content-Type header in one shared Slack client rather than trusting library defaults, and include it in a contract test that inspects outgoing requests. Re-run that test when you upgrade the HTTP library or add a proxy, because both can silently change headers.
Official reference: Slack API reference - chat.postMessage errors. See all Slack error codes or the Slack limits and quotas.
Related codes
- invalid_post_type: Unsupported Content-Type on POSTThe method was called via a POST request, but the specified Content-Type was…
- missing_post_type: POST body sent without a Content-Type headerThe method was called via a POST request and included a data payload, but the…
- invalid_form_data: Form data missing or syntactically invalidThe method was called via a POST request with Content-Type…
Error invalid_charset - quick answers
What does Slack error invalid_charset mean?
Your POST carried a Content-Type header with a charset parameter Slack does not accept. The documented list of valid charset names is short: utf-8 and iso-8859-1 . Anything else in that slot fails the request before any argument is read. Nobody writes a bad charset on purpose, so this almost always comes from a library default or a copy-pasted header.
How do I fix Slack error invalid_charset?
1. Log the outgoing Content-Type header exactly as sent, after any middleware. 2. Set it explicitly to application/json; charset=utf-8 (or application/x-www-form-urlencoded; charset=utf-8 for form bodies). 3. Make sure the body bytes really are UTF-8 so the declared charset is truthful. 4. If a proxy is involved, send one request directly to slack.com to confirm the proxy is the source.
Should I retry after error invalid_charset?
No. Retrying the same request produces the same error; the condition has to be fixed first. Treat it as a permanent failure for that message and surface it, rather than looping.
Stop debugging Slack by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.