Skip to content

[Bug]: Unhandled Promise Rejection causing Gateway crash #4501

@LaserHuy

Description

@LaserHuy

Bug Report for Clawdbot Team

Issue: Unhandled Promise Rejection causing Gateway crash


Environment

  • Version: 2026.1.24-3
  • OS: Windows_NT 10.0.26200 (x64)
  • Node: v24.0.1
  • Model: anthropic/claude-sonnet-4-5
  • Gateway Mode: local (loopback)
  • Channel: Telegram (enabled)

Error Details

[clawdbot] Unhandled promise rejection: TypeError: fetch failed
    at node:internal/deps/undici/undici:15363:13
    at processTicksAndRejections (node:internal/process/task_queues:105:5)

Timestamp: 2026-01-29T19:08:14.678Z
Log File: \tmp\clawdbot\clawdbot-2026-01-29.log (line ~16MB in)


Context

  • State: Gateway was idle (no active agent runs)
  • Last Activity: Normal WebSocket polling (node.list) at 19:08:11
  • Crash: 3 seconds later at 19:08:14
  • Recovery: Auto-restart via Windows Task Scheduler successful

Activity before crash:

  • 19:08:06 - node.list response (3ms)
  • 19:08:11 - node.list response (4ms)
  • 19:08:14 - 💥 Crash

No incoming Telegram messages or user activity at crash time.


Suspected Cause

Unhandled rejection in background fetch operation, likely:

  1. Telegram Bot API long-polling (getUpdates) timeout/network failure
  2. Heartbeat check to external service
  3. Stale HTTP request cleanup

The crash occurs during idle time with no active agent workload, suggesting a background polling or health-check operation.


Expected Behavior

Network failures in background operations should be caught and logged, not crash the gateway process.


Suggested Fix

Add .catch() handlers to all background fetch operations:

  • Telegram getUpdates polling
  • Heartbeat/health checks
  • Any cleanup/timeout handlers

Consider adding a global unhandled rejection handler with graceful degradation instead of process crash.


Reproduction

Intermittent - appears to happen during network instability or API timeouts during idle periods. Not reliably reproducible.


Impact

Severity: Medium

  • Gateway crashes and requires restart
  • Auto-recovery works (Task Scheduler restart)
  • No data loss
  • User experience interrupted briefly

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions