openclaw - 💡(How to fix) Fix Telegram delivery: QUOTE_TEXT_INVALID not handled, drops messages instead of retrying without native quote [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#74581Fetched 2026-04-30 06:22:42
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Telegram Bot API returns 400 Bad Request: QUOTE_TEXT_INVALID when a reply_parameters.quote field doesn't match the source message exactly (common after edit, deletion, or chunked-message reply). The current quote-error fallback only matches "quote not found", so QUOTE_TEXT_INVALID falls through and the entire reply is dropped.

Error Message

Telegram Bot API returns 400 Bad Request: QUOTE_TEXT_INVALID when a reply_parameters.quote field doesn't match the source message exactly (common after edit, deletion, or chunked-message reply). The current quote-error fallback only matches "quote not found", so QUOTE_TEXT_INVALID falls through and the entire reply is dropped.

Root Cause

Telegram Bot API returns 400 Bad Request: QUOTE_TEXT_INVALID when a reply_parameters.quote field doesn't match the source message exactly (common after edit, deletion, or chunked-message reply). The current quote-error fallback only matches "quote not found", so QUOTE_TEXT_INVALID falls through and the entire reply is dropped.

Fix Action

Fix / Workaround

Workaround currently in use

Code Example

[telegram] sendMessage failed: Call to 'sendMessage' failed! (400: Bad Request: QUOTE_TEXT_INVALID)

---

-const QUOTE_PARAM_RE = /\bquote not found\b/i;
+const QUOTE_PARAM_RE = /\bquote not found\b|QUOTE_TEXT_INVALID|quote text invalid/i;
RAW_BUFFERClick to expand / collapse

Description

Telegram Bot API returns 400 Bad Request: QUOTE_TEXT_INVALID when a reply_parameters.quote field doesn't match the source message exactly (common after edit, deletion, or chunked-message reply). The current quote-error fallback only matches "quote not found", so QUOTE_TEXT_INVALID falls through and the entire reply is dropped.

Reproduction

  1. Send a message in a Telegram group where the bot replies with a native quote (reply_parameters.quote_text set).
  2. The quoted text doesn't match the original (e.g., source was edited, or chunking truncated the quote).
  3. Bot drops the reply silently. Log shows:
[telegram] sendMessage failed: Call to 'sendMessage' failed! (400: Bad Request: QUOTE_TEXT_INVALID)

Expected behavior

QUOTE_TEXT_INVALID should trigger the same fallback path — retry without the native quote (legacy reply_to_message_id).

Proposed fix (one-line)

In extensions/telegram/src/bot/delivery.send.ts:

-const QUOTE_PARAM_RE = /\bquote not found\b/i;
+const QUOTE_PARAM_RE = /\bquote not found\b|QUOTE_TEXT_INVALID|quote text invalid/i;

Environment

  • OpenClaw 2026.4.26 (commit be8c246)
  • macOS / Node.js 22 LTS
  • Single occurrence in last 7 days, observed mid-conversation in a Telegram supergroup

Workaround currently in use

Inline regex extension at dist/extensions/telegram/delivery-BmuKO0Rm.js line 19 (built file). Survives until next openclaw update.

Notes for maintainers

  • Consider auditing other Bad Request: <CODE> strings from Telegram Bot API for similar fallback gaps.
  • The handler already exists and works correctly — only the matcher is incomplete.

extent analysis

TL;DR

Update the regular expression in delivery.send.ts to match QUOTE_TEXT_INVALID and trigger the quote-error fallback.

Guidance

  • Review the proposed fix in extensions/telegram/src/bot/delivery.send.ts and apply the updated regular expression to match QUOTE_TEXT_INVALID.
  • Verify that the fallback path is triggered correctly by checking the logs for successful retries without native quotes.
  • Test the updated code with different scenarios, such as edited or chunked messages, to ensure the fix works as expected.
  • Consider auditing other Bad Request: <CODE> strings from Telegram Bot API for similar fallback gaps.

Example

The proposed fix updates the regular expression to match QUOTE_TEXT_INVALID:

-const QUOTE_PARAM_RE = /\bquote not found\b/i;
+const QUOTE_PARAM_RE = /\bquote not found\b|QUOTE_TEXT_INVALID|quote text invalid/i;

Notes

The fix assumes that the handler already exists and works correctly, and only the matcher needs to be updated.

Recommendation

Apply the workaround by updating the regular expression in delivery.send.ts, as it is a targeted fix for the specific issue and does not introduce new dependencies or version changes.

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…

FAQ

Expected behavior

QUOTE_TEXT_INVALID should trigger the same fallback path — retry without the native quote (legacy reply_to_message_id).

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 Telegram delivery: QUOTE_TEXT_INVALID not handled, drops messages instead of retrying without native quote [1 comments, 2 participants]