Summary
The gateway process exits with code 1 when a single outbound connection hits ENETUNREACH. A momentary network unreachability (e.g. Telegram's IP briefly unavailable) causes the entire gateway to crash, disconnecting all agents and sessions.
Error from log
2026-04-16T18:44:37.946+07:00 [openclaw] Uncaught exception: Error: connect ENETUNREACH 149.154.167.220:443 - Local (0.0.0.0:62855)
at internalConnect (node:net:1110:16)
...
at connect (/Users/greg/codebase/openclaw/node_modules/undici/lib/core/connect.js:70:20)
ELIFECYCLE Command failed with exit code 1.
149.154.167.220 is a Telegram API IP. The connection error bubbled up as an uncaught exception and terminated the Node process.
Impact
- All TUI clients show "gateway disconnected: closed | idle"
- All agent sessions drop — "not connected to gateway — message not sent"
- Gateway must be manually restarted
- Any in-progress agent work is lost
Expected behavior
A failed outbound network connection (even a persistent one) should be caught and handled gracefully — log the error, back off and retry, and keep the gateway running. A single provider's network being temporarily unreachable should never take down the whole process.
Steps to reproduce
- Run gateway with Telegram connected
- Briefly interrupt network connectivity to Telegram's IPs (or have ISP/routing hiccup)
- Gateway exits immediately
Suggested fix
- Wrap the Telegram connection/polling loop in a try/catch or attach an
error event handler on the underlying socket/agent so ENETUNREACH is caught at the connection level
- Add a top-level
process.on('uncaughtException') handler that logs the error and decides whether it is fatal rather than always crashing
- Alternatively, wrap outbound requests in a circuit breaker that absorbs transient network errors
Summary
The gateway process exits with code 1 when a single outbound connection hits
ENETUNREACH. A momentary network unreachability (e.g. Telegram's IP briefly unavailable) causes the entire gateway to crash, disconnecting all agents and sessions.Error from log
149.154.167.220is a Telegram API IP. The connection error bubbled up as an uncaught exception and terminated the Node process.Impact
Expected behavior
A failed outbound network connection (even a persistent one) should be caught and handled gracefully — log the error, back off and retry, and keep the gateway running. A single provider's network being temporarily unreachable should never take down the whole process.
Steps to reproduce
Suggested fix
errorevent handler on the underlying socket/agent soENETUNREACHis caught at the connection levelprocess.on('uncaughtException')handler that logs the error and decides whether it is fatal rather than always crashing