Skip to content

Telegram sendMessage fails with 'Network request failed' while curl/standalone Node works #4847

@talentseek

Description

@talentseek

Environment

  • OpenClaw version: 2026.1.29
  • Node versions tested: v22.22.0, v24.13.0
  • OS: macOS 26.2 (arm64)
  • Telegram mode: Long-polling (default)

Problem

Telegram sendMessage, sendChatAction, and other outbound API calls fail with:

Network request for 'sendMessage' failed!
TypeError: fetch failed
    at node:internal/deps/undici/undici:14902:13

Inbound messages work fine — the gateway receives Telegram messages via getUpdates long-polling. Only outbound calls fail.

Key finding: It's NOT a network issue

Both curl and standalone Node.js work perfectly:

# Works
curl -s "https://api.telegram.org/bot<token>/sendMessage" -d "chat_id=<id>" -d "text=test"

# Works
node -e "fetch('https://api.telegram.org/bot<token>/sendMessage', {method:'POST', body: new URLSearchParams({chat_id:'<id>',text:'test'})}).then(r=>r.json()).then(console.log)"

# Works
node -e "require('https').request({hostname:'api.telegram.org', path:'/bot<token>/sendMessage', method:'POST'}, ...).end()"

Only the gateway process's fetch calls fail.

Steps to reproduce

  1. Configure Telegram bot token in channels.telegram.botToken
  2. Approve a user via pairing
  3. User sends message → gateway receives it ✅
  4. Gateway tries to reply → Network request for 'sendMessage' failed!

Logs

2026-01-30T18:55:16.513Z ERROR telegram sendMessage failed: Network request for 'sendMessage' failed!
2026-01-30T18:55:16.534Z ERROR telegram final reply failed: HttpError: Network request for 'sendMessage' failed!

The logs show telegram: autoSelectFamily=false (default-node22) on startup.

Attempted fixes (none worked)

  • Restarting gateway multiple times
  • Flushing DNS cache
  • Switching between Node 22.22.0 and Node 24.13.0
  • Gateway stop/start cycle

Workaround

Using curl via exec to send Telegram messages works, but obviously not sustainable.

Possible cause

Something specific to how undici/fetch is used in the long-running gateway process vs one-shot Node scripts. Maybe connection pooling, keep-alive, or DNS caching issue within the process?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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