openclaw - 💡(How to fix) Fix Telegram: Bot not initialized / ENETUNREACH to api.telegram.org while curl/Python work fine [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…

The OpenClaw Telegram channel fails to initialize since gateway startup. The bot never completes bootstrap — deleteWebhook, deleteMyCommands, and getMe all fail with network errors. Once stuck, every incoming update is spooled to disk and retried endlessly with "Bot not initialized!", but nothing ever succeeds.

Meanwhile, curl and Python httpx from the same machine reach api.telegram.org without issues.

Error Message

The error ENETUNREACH (Network is unreachable) from Node.js's undici HTTP client suggests:

Root Cause

The error ENETUNREACH (Network is unreachable) from Node.js's undici HTTP client suggests:

  • DNS resolves correctly — both IPv4 (149.154.166.110) and IPv6 (2001:67c:4e8:f004::9) addresses
  • Node.js/undici may prefer IPv6 — WSL2's IPv6 routing to Telegram's AS (62041, 149.154.160.0/20) may be broken/blocked
  • Python httpx and curl default to IPv4 — they connect fine
  • The fetch fallback mechanism tries alternative IPs but those also fail when the underlying transport prefers IPv6

The --resolve equivalent in OpenClaw's fetch fallback uses the host header + SNI override approach, but if Node.js's own connection logic is defaulting to IPv6 first and failing before the fallback kicks in, it never reaches the working IPv4 path.

Fix Action

Fixed

Code Example

[telegram] deleteWebhook failed: Network request for 'deleteWebhook' failed!
   [telegram] deleteMyCommands failed: Network request for 'deleteMyCommands' failed!

---

[telegram] [diag] spooled update 68913266 handler failed; keeping for retry:
   Bot not initialized! Either call `await bot.init()`, or directly set the
   `botInfo` option in the `Bot` constructor to specify a known bot info object.

---

[telegram] message failed: Network request for 'sendMessage' failed!

---

[telegram] fetch fallback: DNS-resolved IP unreachable; trying alternative
   Telegram API IP (codes=ENETUNREACH)

---

$ curl https://api.telegram.org/HTTP 302 (0.8s)   $ python3 -c "import httpx; httpx.get('https://api.telegram.org/bot')"
RAW_BUFFERClick to expand / collapse

Bug: Telegram channel stuck at "Bot not initialized!" — Node.js gets ENETUNREACH to api.telegram.org while curl/Python work fine

Description

The OpenClaw Telegram channel fails to initialize since gateway startup. The bot never completes bootstrap — deleteWebhook, deleteMyCommands, and getMe all fail with network errors. Once stuck, every incoming update is spooled to disk and retried endlessly with "Bot not initialized!", but nothing ever succeeds.

Meanwhile, curl and Python httpx from the same machine reach api.telegram.org without issues.

Symptoms

  1. Bootstrap never completes — all initial API calls fail:

    [telegram] deleteWebhook failed: Network request for 'deleteWebhook' failed!
    [telegram] deleteMyCommands failed: Network request for 'deleteMyCommands' failed!
  2. "Bot not initialized!" — repeated 7,700+ times across hours:

    [telegram] [diag] spooled update 68913266 handler failed; keeping for retry:
    Bot not initialized! Either call `await bot.init()`, or directly set the
    `botInfo` option in the `Bot` constructor to specify a known bot info object.
  3. Outgoing messages also fail:

    [telegram] message failed: Network request for 'sendMessage' failed!
  4. Fetch fallback shows ENETUNREACH:

    [telegram] fetch fallback: DNS-resolved IP unreachable; trying alternative
    Telegram API IP (codes=ENETUNREACH)
  5. Works fine from same machine with other tools:

    $ curl https://api.telegram.org/ → HTTP 302 (0.8s) ✅
    $ python3 -c "import httpx; httpx.get('https://api.telegram.org/bot')" ✅

Environment

  • OS: Ubuntu (WSL2 on Windows)
  • OpenClaw version: v2026.5.12
  • Node version: v22.22.2
  • Runtime: systemd user service (openclaw-gateway.service), PID 536
  • Gateway command: /usr/bin/node .../openclaw/dist/index.js gateway --port 18789
  • DNS resolution: api.telegram.org resolves to 149.154.166.110 (IPv4) and 2001:67c:4e8:f004::9 (IPv6)

Steps to Reproduce

  1. Start OpenClaw gateway with Telegram channel enabled
  2. Observe [telegram] starting provider
  3. Bootstrap calls (deleteWebhook, deleteMyCommands, getMe) fail immediately
  4. Bot stays in uninitialized state indefinitely

Root Cause Analysis

The error ENETUNREACH (Network is unreachable) from Node.js's undici HTTP client suggests:

  • DNS resolves correctly — both IPv4 (149.154.166.110) and IPv6 (2001:67c:4e8:f004::9) addresses
  • Node.js/undici may prefer IPv6 — WSL2's IPv6 routing to Telegram's AS (62041, 149.154.160.0/20) may be broken/blocked
  • Python httpx and curl default to IPv4 — they connect fine
  • The fetch fallback mechanism tries alternative IPs but those also fail when the underlying transport prefers IPv6

The --resolve equivalent in OpenClaw's fetch fallback uses the host header + SNI override approach, but if Node.js's own connection logic is defaulting to IPv6 first and failing before the fallback kicks in, it never reaches the working IPv4 path.

Expected Behavior

Telegram channel should initialize and maintain connection within a few seconds of gateway startup.

Actual Behavior

Bot never initializes. All updates spooled to disk and retried indefinitely with "Bot not initialized!". Outgoing sendMessage also fails.

Possible Fixes (not tested)

  1. Force IPv4-only resolution for api.telegram.org in Node.js (e.g., NODE_OPTIONS=--dns-result-order=ipv4first or --dns-order=ipv4first)
  2. Resolve api.telegram.org to IPv4 only in /etc/hosts before gateway starts
  3. Add IPv4 preference logic in OpenClaw's Telegram channel init
  4. Increase deleteWebhook/getMe timeout to account for slow IPv6 fallback

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 Telegram: Bot not initialized / ENETUNREACH to api.telegram.org while curl/Python work fine [1 pull requests]