Problem
When running Clawdbot on unstable network connections (e.g., Starlink satellite internet with micro-interruptions), the gateway crashes frequently due to unhandled fetch failed errors.
The current behavior in src/infra/unhandled-rejections.ts calls process.exit(1) on any unhandled promise rejection, including transient network errors that should be tolerated.
Error logs:
[clawdbot] Unhandled promise rejection: TypeError: fetch failed
at node:internal/deps/undici/undici:14902:13
at processTicksAndRejections (node:internal/process/task_queues:105:5)
This happens repeatedly on connections with brief interruptions, causing the gateway to crash and restart constantly.
Proposed Fix
Modify installUnhandledRejectionHandler() to detect transient network errors and log them instead of exiting:
export function installUnhandledRejectionHandler() {
process.on("unhandledRejection", (reason, _promise) => {
if (isUnhandledRejectionHandled(reason))
return;
const errorStr = formatUncaughtError(reason);
console.error("[clawdbot] Unhandled promise rejection:", errorStr);
// Don't exit on transient network errors - just log and continue
const isTransientNetworkError =
(reason instanceof TypeError && reason.message === "fetch failed") ||
(reason instanceof Error && (
reason.message.includes("fetch failed") ||
reason.message.includes("ECONNRESET") ||
reason.message.includes("ETIMEDOUT") ||
reason.message.includes("ENOTFOUND") ||
reason.message.includes("socket hang up") ||
reason.message.includes("network") ||
reason.name === "AbortError"
));
if (isTransientNetworkError) {
console.warn("[clawdbot] Transient network error detected, continuing...");
return;
}
process.exit(1);
});
}
Impact
- Users on Starlink, mobile hotspots, or any unstable connection can use Clawdbot without constant crashes
- The gateway remains resilient to brief network interruptions
- Real errors still cause exit as expected
Environment
- Clawdbot version: 2026.1.24-3
- OS: macOS (Apple Silicon)
- Network: Starlink satellite internet
Contributed by @caiovicentino
Problem
When running Clawdbot on unstable network connections (e.g., Starlink satellite internet with micro-interruptions), the gateway crashes frequently due to unhandled
fetch failederrors.The current behavior in
src/infra/unhandled-rejections.tscallsprocess.exit(1)on any unhandled promise rejection, including transient network errors that should be tolerated.Error logs:
This happens repeatedly on connections with brief interruptions, causing the gateway to crash and restart constantly.
Proposed Fix
Modify
installUnhandledRejectionHandler()to detect transient network errors and log them instead of exiting:Impact
Environment
Contributed by @caiovicentino