Skip to content

[Bug] Telegram message tool fails with 'fetch failed' while normal replies work (Node 22) #5311

@simyco

Description

@simyco

Summary

Telegram message tool with action=send fails with "Network request for 'sendMessage' failed!" while normal conversation replies work fine. The gateway doesn't crash but all proactive sends fail.

Environment

  • OS: Linux 6.8.0-90-generic (x64)
  • Node: v22.22.0
  • OpenClaw: 2026.1.29
  • Channel: Telegram (grammY)
  • Gateway: Local (loopback)

Steps to Reproduce

  1. Configure Telegram channel with bot token
  2. Start gateway normally
  3. Receive messages from user (works ✅)
  4. Send normal replies (works ✅)
  5. Use message tool with action=send to send proactive message
  6. Observe failure: Network request for 'sendMessage' failed!

Observed Behavior

[telegram] message failed: Network request for 'sendMessage' failed!
[tools] message failed: Network request for 'sendMessage' failed!
[openclaw] Non-fatal unhandled rejection (continuing): TypeError: fetch failed
    at node:internal/deps/undici/undici:14902:13
    at processTicksAndRejections (node:internal/process/task_queues:105:5)

Key Observations

  • ✅ Gateway receives incoming Telegram messages
  • ✅ Normal agent replies (via session) work perfectly
  • ❌ Tool-based sends (message action=send) fail consistently
  • sendChatAction also fails with same error
  • Gateway log shows: autoSelectFamily=false (default-node22)
  • Manual curl to Telegram API works
  • Manual node -e "fetch(...)" in new process works
  • Only the gateway process has the issue

Logs

Gateway startup:

2026-01-31T09:47:28.558Z [telegram] autoSelectFamily=false (default-node22)

Repeated failures:

2026-01-31T09:47:44.211Z [telegram] message failed: Network request for 'sendMessage' failed!
2026-01-31T09:47:44.248Z [openclaw] Non-fatal unhandled rejection (continuing): TypeError: fetch failed
2026-01-31T09:47:45.219Z [telegram] sendChatAction failed: Network request for 'sendChatAction' failed!

Expected Behavior

The message tool should successfully send messages to Telegram, just like normal conversation replies do.

Workaround Attempted

  • ✅ Verified bot token is valid (manual API calls work)
  • ✅ Restarted gateway with gateway.restart
  • ✅ Full systemctl stop/start
  • ❌ Problem persists after all restarts

Hypothesis

Possible IPv4/IPv6 dual-stack issue with Node 22's autoSelectFamily=false setting, or network state corruption in the gateway process that doesn't affect normal reply flow.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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