Slack API · error code

Slack error invalid_form_data: Form data missing or syntactically invalid

Permanent - do not retryHTTP 200Message content & Block Kit

Last verified against Slack API reference - chat.postMessage errors

What Slack returns
The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.

What error invalid_form_data means

You told Slack the body is form data, either application/x-www-form-urlencoded or multipart/form-data, and then the body did not parse as that. Per the docs, the form data "was either missing or syntactically invalid." Slack never reached your arguments.

The usual story is a header and body that disagree. A JSON object was sent under a form Content-Type, a multipart header was set by hand without the boundary the body actually uses, or the body went out empty because a stream was consumed twice (for example, by a logging interceptor that read it first). Bad percent-encoding, such as a raw % or & inside a value, can also break URL-encoded parsing.

Slack's Web API guide recommends JSON bodies for write methods that take structured arguments, because nested data is awkward to form-encode. Switching to JSON is usually the cleanest fix.

What it looks like

POST /api/chat.postMessage
Content-type: application/x-www-form-urlencoded

{"channel":"C123ABC456","text":"hi"}

{"ok": false, "error": "invalid_form_data"}

Why it happens

  • A JSON body was sent with a form Content-Type header.
  • A multipart Content-Type was set manually, so its boundary does not match the body.
  • The request body was empty because a stream was read earlier by middleware or a retry wrapper.
  • Values containing &, = or % were not percent-encoded.

How to fix Slack error invalid_form_data

  1. 1Dump the raw request (headers plus body) and confirm the body format matches the declared Content-Type.
  2. 2Let your HTTP library build multipart bodies and set the boundary itself; never hard-code it.
  3. 3URL-encode every value in form bodies, or move to application/json with a Bearer token.
  4. 4On retries, rebuild the body from source data instead of re-sending a consumed stream.

How to stop it recurring

Pick one encoding per method in your client wrapper, JSON for write calls, and let the library generate headers that match. Add a test that replays a retry path, since consumed request streams are a frequent hidden cause of empty bodies.

Official reference: Slack API reference - chat.postMessage errors. See all Slack error codes or the Slack limits and quotas.

Related codes

Error invalid_form_data - quick answers

What does Slack error invalid_form_data mean?

You told Slack the body is form data, either application/x-www-form-urlencoded or multipart/form-data , and then the body did not parse as that. Per the docs, the form data "was either missing or syntactically invalid." Slack never reached your arguments. The usual story is a header and body that disagree.

How do I fix Slack error invalid_form_data?

1. Dump the raw request (headers plus body) and confirm the body format matches the declared Content-Type. 2. Let your HTTP library build multipart bodies and set the boundary itself; never hard-code it. 3. URL-encode every value in form bodies, or move to application/json with a Bearer token. 4. On retries, rebuild the body from source data instead of re-sending a consumed stream.

Should I retry after error invalid_form_data?

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.