Skip to content

Gateway crashes on unhandled fetch rejection (TypeError: fetch failed) #4248

@iGOTHAM

Description

@iGOTHAM

Bug Report

Version: 2026.1.24-2 (d1dd8a1)
OS: Windows 10.0.26200 (x64), Node v24.12.0
Channel: Telegram

Problem

The gateway process crashes repeatedly due to unhandled promise rejections from failed etch calls. A single network hiccup kills the entire gateway.

Error

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

Frequency

Happened 3 times in one afternoon (Jan 29, 2026):

  • 4:51 PM ET — crashed, was down for 1+ hour until manual restart
  • 6:31 PM ET — crashed, watchdog restarted in 6s
  • 6:33 PM ET — crashed again, watchdog restarted in 8s

Context

Gateway was running normally with Telegram channel active, multiple cron sessions, and browser automation sub-agents. The crash appears to occur during routine network operations (likely Telegram long-polling or API calls).

Expected Behavior

A failed fetch should be caught and retried or logged — not crash the entire gateway process. All outgoing network calls should be wrapped in try/catch or have .catch() handlers on their promises.

Workaround

Running a PowerShell watchdog script that polls the gateway every 60s and runs \clawdbot gateway start\ if unreachable. This limits downtime to ~10 seconds but doesn't fix the root cause.

Suggestion

Consider adding a global \process.on('unhandledRejection')\ handler that logs the error and continues rather than crashing, or audit all fetch/HTTP calls for proper error handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions