openclaw - 💡(How to fix) Fix sessions_send announce delivery fails for Telegram groups: recipient must be a numeric chat ID [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error: Telegram recipient must be a numeric chat ID

Root Cause

Traced through the code:

  1. Sage's group session key: agent:sage:telegram:group:-5072149164

  2. resolveAnnounceTargetFromKey() in sessions-send-helpers.ts builds the target as:

    const genericTarget = parsed.kind === "channel" ? `channel:${parsed.id}` : `group:${parsed.id}`;

    Result: group:-5072149164

  3. resolveSessionTelegramOriginTarget() calls normalizeTelegramChatId() on the target, which does not strip the group: prefix — it only strips telegram:/tg: prefixes first, then checks if the result is numeric.

  4. stripTelegramInternalPrefixes() in send-sxDwUGaO.js (~line 28):

    if (strippedTelegramPrefix && /^group:/i.test(trimmed)) return trimmed.replace(/^group:/i, "").trim();

    This only strips group: if strippedTelegramPrefix is true, meaning the target must start with telegram: or tg:. A standalone group:-5072149164 never triggers the prefix strip.

  5. resolveChatId() then throws: "Telegram recipient must be a numeric chat ID" because group:-5072149164 doesn't match TELEGRAM_NUMERIC_CHAT_ID_REGEX (/^-?\d+$/).

Fix Action

Fixed

Code Example

Error: Telegram recipient must be a numeric chat ID

---

Telegram send failed: chat not found (chat_id=-5072149164)

---

const genericTarget = parsed.kind === "channel" ? `channel:${parsed.id}` : `group:${parsed.id}`;

---

if (strippedTelegramPrefix && /^group:/i.test(trimmed)) return trimmed.replace(/^group:/i, "").trim();

---

{
  "deliveryContext": { "channel": "telegram", "to": "telegram:-5072149164" },
  "origin": { "to": "telegram:-5072149164" },
  "groupId": "-5072149164"
}
RAW_BUFFERClick to expand / collapse

Bug Description

sessions_send with delivery.mode: "announce" fails to deliver messages to Telegram group chats in OpenClaw 2026.5.7. All deliveries to the group fail with:

Error: Telegram recipient must be a numeric chat ID

and after delivery queue retry:

Telegram send failed: chat not found (chat_id=-5072149164)

This is a regression from 2026.4.23.

Root Cause Analysis

Traced through the code:

  1. Sage's group session key: agent:sage:telegram:group:-5072149164

  2. resolveAnnounceTargetFromKey() in sessions-send-helpers.ts builds the target as:

    const genericTarget = parsed.kind === "channel" ? `channel:${parsed.id}` : `group:${parsed.id}`;

    Result: group:-5072149164

  3. resolveSessionTelegramOriginTarget() calls normalizeTelegramChatId() on the target, which does not strip the group: prefix — it only strips telegram:/tg: prefixes first, then checks if the result is numeric.

  4. stripTelegramInternalPrefixes() in send-sxDwUGaO.js (~line 28):

    if (strippedTelegramPrefix && /^group:/i.test(trimmed)) return trimmed.replace(/^group:/i, "").trim();

    This only strips group: if strippedTelegramPrefix is true, meaning the target must start with telegram: or tg:. A standalone group:-5072149164 never triggers the prefix strip.

  5. resolveChatId() then throws: "Telegram recipient must be a numeric chat ID" because group:-5072149164 doesn't match TELEGRAM_NUMERIC_CHAT_ID_REGEX (/^-?\d+$/).

Affected Code Paths

  • resolveAnnounceTargetFromKey() → builds group:<id> target
  • resolveSessionTelegramOriginTarget() → calls normalizeTelegramChatId() which fails to handle group: prefix
  • stripTelegramInternalPrefixes() in send-sxDwUGaO.js → only strips group: after telegram: prefix
  • resolveChatId() → throws the final error

Reproduction

  1. Configure a Telegram group with a numeric chat ID in channels.telegram.accounts.<id>.groups
  2. Have an agent respond to a group message
  3. Use sessions_send from another session targeting the group session key (e.g. agent:sage:telegram:group:-5072149164)
  4. Announce delivery resolves to: "group:-5072149164" instead of to: "-5072149164"
  5. Telegram API rejects the non-numeric chat_id

Suggested Fix

resolveSessionTelegramOriginTarget() should use the same normalization as resolveTelegramDeliveryTarget() or normalizeTelegramMessagingTarget() instead of calling normalizeTelegramChatId() directly. Alternatively, stripTelegramInternalPrefixes() should handle standalone group: prefixes (not only when preceded by telegram:/tg:).

Session Store (for reference)

The session store metadata is correct:

{
  "deliveryContext": { "channel": "telegram", "to": "telegram:-5072149164" },
  "origin": { "to": "telegram:-5072149164" },
  "groupId": "-5072149164"
}

The issue is purely in the announce delivery target resolution layer.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix sessions_send announce delivery fails for Telegram groups: recipient must be a numeric chat ID [1 pull requests]