Summary
Gateway exits with an uncaught exception when a console warning is emitted. The crash is Error: write EIO originating from console.warn inside the console capture wrapper in src/logging.ts.
Steps to reproduce
- Start the gateway in the foreground:
pnpm clawdbot gateway.
- Wait for a slow Discord listener warning to be logged (for me this happens after inbound Discord traffic and shows
DiscordMessageListener took ... for event MESSAGE_CREATE).
- Observe the gateway process exits shortly after the warning is logged.
Expected behavior
The gateway should keep running even if stdout/stderr cannot be written to; logging failures should not crash the process.
Actual behavior
The process exits with an uncaught exception. The WebSocket server stops listening on ws://127.0.0.1:18789 right after the error is logged.
Environment
- Clawdbot version: 2026.1.11-4 (startup banner shows commit 25297ce)
- Node: v24.10.0 (from log metadata)
- OS: macOS (Darwin)
- Install method: pnpm in repo (
pnpm clawdbot gateway runs tsx src/entry.ts gateway)
Logs or screenshots
Log excerpt (redacted paths):
2026-01-13T08:17:49.879Z WARN [discord-auto-reply] [EventQueue] Slow listener detected: DiscordMessageListener took 107.2 seconds for event MESSAGE_CREATE
2026-01-13T08:17:49.879Z WARN [EventQueue] Slow listener detected: DiscordMessageListener took 107165ms for event MESSAGE_CREATE
2026-01-13T08:17:49.884Z ERROR [clawdbot] Uncaught exception: Error: write EIO
at afterWriteDispatched (node:internal/stream_base_commons:159:15)
at writeGeneric (node:internal/stream_base_commons:150:3)
at WriteStream.Socket._writeGeneric (node:net:966:11)
at WriteStream.Socket._write (node:net:978:8)
at writeOrBuffer (node:internal/streams/writable:570:12)
at _write (node:internal/streams/writable:499:10)
at WriteStream.Writable.write (node:internal/streams/writable:508:10)
at console.value (node:internal/console/constructor:308:16)
at console.warn (node:internal/console/constructor:416:26)
at console.warn (file://<repo-root>/src/logging.ts:3:68)
Notes
- The console capture wrapper in
src/logging.ts only ignores EPIPE (isEpipeError), so EIO bubbles and becomes an uncaught exception.
- This crash happened multiple times with the same stack trace after a slow Discord listener warning.
Summary
Gateway exits with an uncaught exception when a console warning is emitted. The crash is
Error: write EIOoriginating fromconsole.warninside the console capture wrapper insrc/logging.ts.Steps to reproduce
pnpm clawdbot gateway.DiscordMessageListener took ... for event MESSAGE_CREATE).Expected behavior
The gateway should keep running even if stdout/stderr cannot be written to; logging failures should not crash the process.
Actual behavior
The process exits with an uncaught exception. The WebSocket server stops listening on
ws://127.0.0.1:18789right after the error is logged.Environment
pnpm clawdbot gatewayrunstsx src/entry.ts gateway)Logs or screenshots
Log excerpt (redacted paths):
Notes
src/logging.tsonly ignoresEPIPE(isEpipeError), soEIObubbles and becomes an uncaught exception.