Slack API · error code

Slack error msg_too_long: Message text is too long

Permanent - do not retryHTTP 200Message content & Block Kit

Last verified against Slack API reference - chat.postMessage errors

What Slack returns
Message text is too long.

What error msg_too_long means

The text you sent exceeds what the method will accept, and Slack rejected the whole message — nothing was truncated for you, nothing was delivered. The chat.update reference is the most explicit about the boundary: "Message text is too long. The text field cannot exceed 4,000 characters." On chat.postMessage, the documentation's guidance is layered: "For best results, limit the number of characters in the text field to 4,000 characters," and separately, "Slack will truncate messages containing more than 40,000 characters." In practice: treat 4,000 as your working budget, 40,000 as the hard wall, and msg_too_long as the sign your content blew past what the endpoint tolerates.

The usual culprits are machine-generated payloads: stack traces, JSON dumps, CI logs, LLM output, or a loop that concatenates a day's worth of items into one send. Message length is counted on the final string after your templating runs, so a template that looks short can inflate enormously with real data. Note that blocks have their own separate budgets — 50 blocks per message and 3,000 characters per section text — with their own errors (invalid_blocks and msg_blocks_too_long), so fixing text does not exempt your Block Kit payload, and vice versa.

Design the fix around intent rather than blind chunking. If the content is a log or document, the right Slack primitive is a file upload (via files.getUploadURLExternal/files.completeUploadExternal) with a short message pointing at it — files render with preview and don't fight message limits. If the content is genuinely conversational, truncate with an explicit marker and a link to the full version, or split on paragraph boundaries into a thread: first message top-level, the rest as replies with thread_ts, which keeps channels readable. Blind 4,000-character splits mid-word or mid-code-fence produce mangled formatting and, with markup, can break entity boundaries.

The error is deterministic — the same payload will fail every time — so automatic retries are pure waste. Both official SDKs surface it as an ordinary platform error (ErrorCode.PlatformError in @slack/web-api, SlackApiError in slack_sdk) and neither retries it. See the full length table in Slack message limits.

What it looks like

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

Why it happens

  • Machine-generated content (stack traces, JSON, logs, LLM output) interpolated into text without a length guard.
  • A digest or loop that accumulates many items into a single send.
  • Templating that inflates far beyond the static template once real values are substituted.
  • Treating chat.postMessage's 40,000-character truncation ceiling as license to send huge text to other methods like chat.update, which enforces 4,000.
  • Retrying the identical oversized payload, which fails identically forever.

How to fix Slack error msg_too_long

  1. 1Measure the final rendered string length before sending; log it alongside the failure to confirm the diagnosis.
  2. 2Cap text at 4,000 characters with an explicit truncation marker ('... truncated, full output attached').
  3. 3Move bulk content (logs, dumps, reports) into a file upload and post a short summary message linking it.
  4. 4For genuinely long conversational content, split on paragraph boundaries and post the remainder as thread replies via thread_ts.
  5. 5Keep Block Kit budgets in mind separately: 3,000 characters per section text and 50 blocks per message.
  6. 6Remove the payload from retry queues once it fails; requeue only a shortened version.

How to stop it recurring

Put a length gate in the one code path that talks to Slack: everything above the cap is summarized or attached, never sent raw. Design templates with worst-case data in mind, and unit-test them with maximal inputs. For alerting bots, prefer 'summary in the message, detail in the file/link' as the default shape — it survives every limit in the message-content table.

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

Related codes

Error msg_too_long - quick answers

What does Slack error msg_too_long mean?

The text you sent exceeds what the method will accept, and Slack rejected the whole message — nothing was truncated for you, nothing was delivered. The chat.update reference is the most explicit about the boundary: "Message text is too long.

How do I fix Slack error msg_too_long?

1. Measure the final rendered string length before sending; log it alongside the failure to confirm the diagnosis. 2. Cap text at 4,000 characters with an explicit truncation marker ('... truncated, full output attached'). 3. Move bulk content (logs, dumps, reports) into a file upload and post a short summary message linking it. 4. For genuinely long conversational content, split on paragraph boundaries and post the remainder as thread replies via thread_ts. 5. Keep Block…

Should I retry after error msg_too_long?

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.