-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
Unhandled fetch rejections crash the gateway #5172
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
Gateway crashes when network fetch calls fail with unhandled promise rejections.
Error
[clawdbot] Unhandled promise rejection: TypeError: fetch failed
at node:internal/deps/undici/undici:14902:13
at processTicksAndRejections (node:internal/process/task_queues:105:5)
Impact
- Gateway crashes and restarts
- All WebSocket connections dropped
- Agent sessions interrupted mid-response
Suggested Fix
Either:
- Add try/catch around the specific fetch calls that are failing
- Add a global safety net:
process.on('unhandledRejection', (err) => {
console.error('[gateway] Unhandled rejection (caught):', err);
// Don't exit - just log it
});Environment
- Clawdbot: 2026.1.24-3
- Node: v22.22.0
- OS: macOS (arm64)
Reproduction
Happens intermittently when network calls to external APIs (Telegram, etc.) fail due to timeouts or connectivity issues.
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.