-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
Unhandled fetch rejection crashes gateway, launchd throttles after crash loop #14649
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
An unhandled TypeError: fetch failed rejection kills the gateway process. With KeepAlive: true in the LaunchAgent, launchd restarts it — but if the underlying network issue persists, it crash-loops until launchd throttles and gives up. The gateway then stays dead silently until manually restarted.
Steps to Reproduce
- Gateway running normally via LaunchAgent with
KeepAlive: true - Network blip or transient API failure (Anthropic, Telegram, Brave search, etc.)
- Gateway crashes with unhandled rejection:
2026-02-11T14:39:26.618Z [clawdbot] Unhandled promise rejection: TypeError: fetch failed
at node:internal/deps/undici/undici:13484:13
- launchd restarts → crashes again → restarts → crash loop
- After ~50 runs, launchd throttles and stops restarting
- Gateway stays dead — Telegram bot (and all cron jobs) go offline silently
Expected Behavior
- Network fetch failures should be caught and retried with backoff, not crash the process
- The gateway should be resilient to transient network issues
Actual Behavior
- Unhandled promise rejection kills the process
last exit code = 1,runs = 50inlaunchctl print- Gateway offline for ~24 hours until manual
clawdbot gateway start
Environment
- clawdbot v2026.1.24-3
- macOS (Darwin 25.2.0)
- Node v22.12.0
- Channel: Telegram (
@Ghostinasshellbot)
Suggested Fix
Add a global process.on('unhandledRejection') handler that logs + recovers instead of crashing. Specifically, fetch calls to external APIs (Anthropic, Telegram Bot API, Brave Search) should have try/catch with retry logic.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.