Skip to content

editEphemeralMessageText throws wrong error MEDIA_CAPTION_TOO_LONG instead of MESSAGE_TOO_LONG and limit mismatch (1024 vs 4096) #881

Description

@beepsound

I found two issues with editEphemeralMessageText.

1. Wrong character limit:
According to the docs, the text limit is 4096 characters, but the method throws an error when text is > 1024 characters.

2. Wrong error type:
When the limit is exceeded, it throws MEDIA_CAPTION_TOO_LONG, which is incorrect for a text message. The expected error should be MESSAGE_TOO_LONG.

The error MEDIA_CAPTION_TOO_LONG should only apply to media captions (which have a 1024 limit), not to editEphemeralMessageText.

Steps to Reproduce:
curl -X POST "https://api.telegram.org/bot<TOKEN>/editEphemeralMessageText"
-H "Content-Type: application/json"
-d '{
"chat_id": -100xx,
"receiver_user_id": 123xxx,
"ephemeral_message_id": 123xxx,
"text": "'$(printf '0%.0s' {1..1025})'"
}'
Expected:

  • Should accept up to 4096 characters
  • If > 4096, should return MESSAGE_TOO_LONG

Actual:

  • Fails at > 1024 characters
  • Returns MEDIA_CAPTION_TOO_LONG

Looks like the backend is validating this as a caption, not as a message text.

Thanks!

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