Skip to content

feat(messages): validate message length before sending to prevent silent Slack truncation #139

@rianjs

Description

@rianjs

Problem

Slack silently truncates messages exceeding 40,000 characters. When slck messages send posts a message that's too long, Slack returns ok: true with a message_truncated warning in response metadata — but slck doesn't parse that warning, so it reports success. The caller has no idea their message was cut off mid-content.

Real-world example: An AI agent used slck messages send to post a ~45K character questionnaire into a Slack thread. The message was truncated mid-word ("Extensio...") and the agent never knew.

Solution

Add client-side message length validation to messages send and messages update:

  1. Error by default when text exceeds 40,000 characters (Slack's hard limit)
  2. Actionable error message with character count and alternatives:
    • --file <path> to upload as a file attachment
    • slck canvas create to create a Slack canvas
    • Manual chunking suggestion
  3. Skip validation for file uploads (the --file path doesn't have this limit)

Scope

Code changes

  • internal/cmd/messages/messages.gomaxMessageTextLen constant + validateMessageLength() function
  • internal/cmd/messages/send.go — validation call in runSend
  • internal/cmd/messages/update.go — validation call in runUpdate
  • Tests for all of the above

Documentation

  • CHANGELOG.md — true up: collapse [Unreleased] into versioned sections ([3.2.0] for new + post-v3.1.35 work, [3.1.35] for previously released items)
  • README.md — add Message Length Limits entry under Known Limitations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions