[GH-ISSUE #1991] TelegramBotHandler: API returns error when long message is split with only whitespace #857

Closed
opened 2026-03-04 03:01:35 +03:00 by kerem · 0 comments
Owner

Originally created by @MacDada on GitHub (Sep 19, 2025).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1991

Monolog 3.9.

When I split long messages and the split happens exactly at the ending part of the message, which happens to contain only whitespace, Telegram API returns error 400:

Bad Request: text must be non-empty

That's because the last (from split) message is just "\n\n".

Originally created by @MacDada on GitHub (Sep 19, 2025). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1991 Monolog 3.9. When I [split long messages](https://github.com/Seldaek/monolog/blob/3.9.0/src/Monolog/Handler/TelegramBotHandler.php#L117) and the split happens exactly at the ending part of the message, which happens to contain only whitespace, [Telegram API returns error 400](https://github.com/Seldaek/monolog/blob/3.9.0/src/Monolog/Handler/TelegramBotHandler.php#L280): > Bad Request: text must be non-empty That's because the last (from split) message is just `"\n\n"`.
kerem 2026-03-04 03:01:35 +03:00
  • closed this issue
  • added the
    Bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#857
No description provided.