Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this pageProducts used
Looking for more inspiration?Visit the
Error
Application error

50504: Programmable Chat: Message body parameter is too long

Twilio Chat DocumentationChat

Description

description page anchor

This error occurs when you create or update a Programmable Chat message with a Body that exceeds the allowed message size. Programmable Chat limits Message Body to 32 KiB.

Possible causes

possible-causes page anchor
  • The Body value in your message request is larger than the 32 KiB limit for a Chat message body.
  • Your application serializes structured data into Body, which makes the message content too large. Twilio allows structured data in Body when you serialize it as a string, so oversized serialized payloads can trigger this error.
  • A pre-event webhook for onMessageSend or onMessageUpdate modifies body before the message is published and pushes it past the allowed limit.
  • Reduce the Body value so it stays within the 32 KiB message body limit.
  • Validate message length in your application before you create or update a message.
  • If you use pre-event webhooks, review your onMessageSend and onMessageUpdate logic and make sure the returned body does not exceed the message size limit.
  • Keep Body focused on message text. If you send structured data in Body, reduce the serialized payload so it fits within the limit.

Additional resources

additional-resources page anchor