Slack API · error code

Slack error invalid_blocks: Blocks are not valid

Permanent - do not retryHTTP 200Message content & Block Kit

Last verified against Slack API reference - chat.postMessage errors

What Slack returns
Blocks submitted with this message are not valid.

What error invalid_blocks means

Your blocks array parsed as JSON but failed Block Kit validation. The documented description — "Blocks submitted with this message are not valid" — is famously unspecific, which makes this one of the most time-consuming Slack errors per incident: a 40-block payload fails, and the string tells you neither which block nor which field. The first move is always the same: log the entire response body, because Slack frequently attaches a response_metadata object whose messages array contains human-readable pointers to the failing block index and field. Code that logs only error discards the only map you get.

The validation rules being violated are almost always documented limits or type mistakes. The budget rules from the Block Kit reference: "You can include up to 50 blocks in each message, and 100 blocks in modals or Home tabs." Per block: a section block's text has a 3,000-character maximum; section fields allow at most 10 items of 2,000 characters each; a header block's text caps at 150 characters; a context block holds at most 10 elements; an actions block at most 25; block_id caps at 255 characters everywhere. Type mistakes are the other half: plain_text supplied where mrkdwn is required (or vice versa), a string where an object belongs, an element placed in a block that does not accept it, or an emoji/URL field that fails format checks.

Dynamic data is the underlying villain. Handwritten blocks fail in development and get fixed; production failures come from templates inflated by real content — a customer name pushing a header past 150 characters, a description pushing section text past 3,000, a loop emitting 60 blocks for a long list. That is why this error correlates with specific records rather than with deploys.

Distinguish the sibling invalid_blocks_format: that one means the blocks value was not even a valid JSON array of objects (typically a double-serialized string), failing before Block Kit rules are consulted. invalid_blocks means the JSON was fine and the content broke the rules. Validate candidate payloads interactively in Slack's Block Kit Builder, which highlights the failing property, and see the full budget table in Slack Block Kit limits.

What it looks like

{
  "ok": false,
  "error": "invalid_blocks",
  "response_metadata": { "messages": [ "...pointer to the failing block..." ] }
}

Why it happens

  • A documented limit exceeded by dynamic content: more than 50 blocks, section text over 3,000 characters, header over 150, more than 10 context elements or 25 actions elements.
  • Wrong text object type: plain_text where mrkdwn is required, or a raw string where a text object belongs.
  • An element used inside a block type that does not support it, or a missing required field (e.g. type).
  • Invalid field formats: overlong block_id (255 max), malformed URLs, bad option values in selects.
  • Section fields exceeding 10 items or 2,000 characters per item.

How to fix Slack error invalid_blocks

  1. 1Log the full response body and read response_metadata.messages — it usually names the failing block index and property.
  2. 2Paste the exact failing payload into Slack's Block Kit Builder to get interactive validation.
  3. 3Clamp every dynamic string to its documented budget before it enters a block (150 header, 3,000 section, 2,000 per field).
  4. 4Cap generated lists at 50 blocks per message (100 in modals/App Home) and paginate or summarize the remainder.
  5. 5Check each block's reference page for element compatibility and required fields.
  6. 6Re-send and keep the validation as a permanent pre-send step, not a one-off fix.

How to stop it recurring

Build blocks through a typed builder or schema validation layer that enforces the documented budgets at construction time, so oversized content is truncated deliberately instead of rejected at send time. Test templates with worst-case data lengths. Keep the Block Kit limits table next to your message builders, and treat any block assembled by string concatenation as a bug waiting for a long customer name.

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

Related codes

Error invalid_blocks - quick answers

What does Slack error invalid_blocks mean?

Your blocks array parsed as JSON but failed Block Kit validation. The documented description — "Blocks submitted with this message are not valid" — is famously unspecific, which makes this one of the most time-consuming Slack errors per incident: a 40-block payload fails, and the string tells you neither which block nor which field.

How do I fix Slack error invalid_blocks?

1. Log the full response body and read response_metadata.messages — it usually names the failing block index and property. 2. Paste the exact failing payload into Slack's Block Kit Builder to get interactive validation. 3. Clamp every dynamic string to its documented budget before it enters a block (150 header, 3,000 section, 2,000 per field). 4. Cap generated lists at 50 blocks per message (100 in modals/App Home) and paginate or summarize the remainder. 5. Check each…

Should I retry after error invalid_blocks?

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.