openclaw - ✅(Solved) Fix Telegram: 421 Misdirected Request not retried, causing silent message drops [1 pull requests, 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#48892Fetched 2026-04-08 00:51:23
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1

When sending messages via the Telegram Bot API, occasional HTTP 421 (Misdirected Request) errors occur due to HTTP/2 connection coalescing. These are not retried, causing replies to be silently dropped.

Root Cause

When sending messages via the Telegram Bot API, occasional HTTP 421 (Misdirected Request) errors occur due to HTTP/2 connection coalescing. These are not retried, causing replies to be silently dropped.

Fix Action

Fixed

PR fix notes

PR #48908: fix(telegram): retry 421 misdirected request responses

Description (problem / solution / changelog)

Summary

  • treat Telegram 421 Misdirected Request responses as retryable transport failures
  • extend the Telegram retry-policy test coverage with a targeted 421 regression case
  • closes #48892

Change Type

  • bug fix

Scope

  • src/infra/retry-policy.ts
  • src/infra/retry-policy.test.ts

User-visible / Behavior Changes

  • Telegram outbound retries now cover transient 421 Misdirected Request responses instead of failing on the first attempt

Test plan

  • pnpm install --frozen-lockfile
  • pnpm exec vitest run --config vitest.unit.config.ts src/infra/retry-policy.test.ts

Changed files

  • src/infra/retry-policy.test.ts (modified, +16/-0)
  • src/infra/retry-policy.ts (modified, +2/-1)
RAW_BUFFERClick to expand / collapse

Description

When sending messages via the Telegram Bot API, occasional HTTP 421 (Misdirected Request) errors occur due to HTTP/2 connection coalescing. These are not retried, causing replies to be silently dropped.

Impact

The agent appears unresponsive to the user — messages are received but replies never arrive. This is particularly problematic when it happens during cron job announcements, as the agent appears completely dead.

Current Behavior

Telegram retry logic (per docs/concepts/retry.md) handles:

  • 429 (rate limit)
  • Timeouts
  • Connection reset/closed
  • Temporarily unavailable

But 421 is not in the retryable list, so it is treated as a permanent failure.

Expected Behavior

421 Misdirected Request should be retried (ideally on a fresh connection), as it is inherently transient — it just means the server rejected the reused HTTP/2 connection.

Frequency

Observed multiple times in a single day (2026-03-16), including during scheduled cron job runs. Appears intermittent but frequent enough to seriously degrade reliability.

Environment

  • OpenClaw 2026.2.6-3
  • Node.js v22.22.0
  • Linux (WSL2)
  • Telegram Bot API

Suggested Fix

Add 421 to the Telegram (and possibly all channel) retry logic in the same category as other transient errors. Ideally force a new TCP/TLS connection on retry to avoid hitting the same coalesced connection.

extent analysis

Fix Plan

To resolve the issue of HTTP 421 errors not being retried when sending messages via the Telegram Bot API, we need to modify the retry logic to include 421 as a transient error. Here are the steps:

  • Update the docs/concepts/retry.md to include 421 in the list of retryable errors.
  • Modify the Telegram Bot API client to retry 421 errors with a fresh connection.

Example code snippet in Node.js:

const axios = require('axios');

// Create a new instance of the axios client with retry logic
const telegramClient = axios.create({
  // ... other config options ...
  retry: 3, // number of retries
  retryDelay: 1000, // delay between retries in ms
});

// Add a custom retry handler for 421 errors
telegramClient.interceptors.push({
  responseError: (error) => {
    const { response } = error;
    if (response && response.status === 421) {
      // Force a new TCP/TLS connection on retry
      return axios.request({
        ...response.config,
        // Create a new instance of the axios client for the retry
        // to avoid hitting the same coalesced connection
        axiosInstance: axios.create(),
      });
    }
    return Promise.reject(error);
  },
});

Verification

To verify that the fix worked, you can:

  • Test sending messages via the Telegram Bot API and check for 421 errors.
  • Monitor the logs for retry attempts and successful deliveries.
  • Verify that the agent is responsive and replies are being delivered as expected.

Extra Tips

  • Make sure to test the fix thoroughly to ensure that it does not introduce any new issues.
  • Consider adding logging and monitoring to track retry attempts and successful deliveries.
  • Review the Telegram Bot API documentation to ensure that the fix is in line with their recommended retry logic.

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 - ✅(Solved) Fix Telegram: 421 Misdirected Request not retried, causing silent message drops [1 pull requests, 1 comments, 2 participants]