Skip to content

Telegram send should ignore non-numeric reply_to_message_id inputs #37222

@bread22

Description

@bread22

Bug

Telegram send path can attempt to use invalid/non-numeric reply ids as reply_to_message_id, causing delivery failures.

Symptom

Intermittent Telegram send failures with:

  • 400: Bad Request: message to be replied not found

Root cause

In src/telegram/send.ts, replyToMessageId was truncated without validating numeric validity first. In cross-surface routing scenarios, upstream reply ids may be UUID-like/non-numeric values.

Proposed fix

Validate replyToMessageId as finite positive integer before attaching:

  • reply_to_message_id
  • reply_parameters.message_id

Otherwise, omit reply threading fields and send normally.

Sanitized logs

telegram message failed: Call to 'sendMessage' failed! (400: Bad Request: message to be replied not found)
gateway/delivery-recovery: Retry failed ... message to be replied not found

Full sanitized snippet prepared locally (no tokens/chat ids included).

Additional context

This is not specific to one account/chat; it can occur whenever a non-Telegram reply id leaks into Telegram delivery context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions