openclaw - 💡(How to fix) Fix [Bug]: Discord gateway stuck at 'awaiting gateway readiness' — --verbose flag as workaround (v2026.4.2) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60559Fetched 2026-04-08 02:49:41
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1locked ×1

Discord adapter connects, resolves guild/channel/users, logs client initialized as ... ; awaiting gateway readiness, then never reaches READY. Outbound (REST API) works fine; inbound (WebSocket gateway) is completely dead. The health monitor cycles stale-socket restarts every ~35 minutes indefinitely.

This persists across:

  • Hot reloads (SIGUSR1 / openclaw gateway restart)
  • Full systemctl --user restart openclaw-gateway
  • Full VM reboot

Root Cause

Root cause confirmation

Fix Action

Fix / Workaround

Workaround: --verbose flag

Code Example

ExecStart=/usr/bin/node .../dist/entry.js gateway --port 18789 --verbose

---

[discord] [default] starting provider (@Fitz)
[discord] channels resolved: XXXXXXXX/XXXXXXXXX (guild:HomeLan; channel:openclaw)
[discord] users resolved: XXXXXXXXXXXXXXX
[discord] channel users resolved:XXXXXXXXXXXXXXX
[discord] client initialized as XXXXXXXXXXXXXXXX (Fitz); awaiting gateway readiness
(silence — no further discord logs ever)

---

discord: config dm=on dmPolicy=allowlist allowFrom=XXXXXXXXXXXXX ...
[discord] [default] starting provider (@Fitz)
[discord] channels resolved: ...
[discord] startup [default] gateway-debug 1671ms Gateway websocket opened
[discord] client initialized as XXXXXXXXXXXXXXXXXXXXX (Fitz); awaiting gateway readiness
(discord fully functional — receives messages, delivers replies)
RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw: v2026.4.2 (d74a122)
  • OS: Ubuntu 24.04 (Proxmox LXC)
  • Node: v22.22.1
  • Discord: 1 guild, 1 channel, groupPolicy: allowlist, single account

Description

Discord adapter connects, resolves guild/channel/users, logs client initialized as ... ; awaiting gateway readiness, then never reaches READY. Outbound (REST API) works fine; inbound (WebSocket gateway) is completely dead. The health monitor cycles stale-socket restarts every ~35 minutes indefinitely.

This persists across:

  • Hot reloads (SIGUSR1 / openclaw gateway restart)
  • Full systemctl --user restart openclaw-gateway
  • Full VM reboot

Root cause confirmation

Raw WebSocket test with the same token, intents (46721), and ws module (v8.19.0 from the same node_modules) connects and receives READY in under 1 second, every time. The issue is inside the @buape/carbon gateway plugin lifecycle, not the network/token/intents.

This matches #56492 — the Client constructor calls plugin.registerClient?.(this) without await, and SafeGatewayPlugin.registerClient is async (fetches gateway metadata, then calls super.registerClient which opens the WebSocket).

Workaround: --verbose flag

Adding --verbose to the gateway startup command reliably fixes the issue:

ExecStart=/usr/bin/node .../dist/entry.js gateway --port 18789 --verbose

Without --verbose: gateway hangs at "awaiting gateway readiness" 100% of the time (tested across multiple restarts and a full VM reboot).

With --verbose: gateway connects and reaches READY immediately. Tested with 60+ messages received, 0 reconnects, 0 errors.

Why --verbose likely works

Verbose mode adds synchronous log I/O calls (console.log) in the gateway debug event handler. This changes Node.js event loop scheduling — the additional I/O microtask yields appear to give the un-awaited registerClient() async chain time to complete the WebSocket handshake before the polling/timeout logic proceeds.

Without verbose logging, the event loop likely runs the waitForGatewayReady polling loop tightly enough that it races past the WebSocket connection establishment.

Startup log comparison

Failing start (no --verbose):

[discord] [default] starting provider (@Fitz)
[discord] channels resolved: XXXXXXXX/XXXXXXXXX (guild:HomeLan; channel:openclaw)
[discord] users resolved: XXXXXXXXXXXXXXX
[discord] channel users resolved:XXXXXXXXXXXXXXX
[discord] client initialized as XXXXXXXXXXXXXXXX (Fitz); awaiting gateway readiness
(silence — no further discord logs ever)

Working start (with --verbose):

discord: config dm=on dmPolicy=allowlist allowFrom=XXXXXXXXXXXXX ...
[discord] [default] starting provider (@Fitz)
[discord] channels resolved: ...
[discord] startup [default] gateway-debug 1671ms Gateway websocket opened
[discord] client initialized as XXXXXXXXXXXXXXXXXXXXX (Fitz); awaiting gateway readiness
(discord fully functional — receives messages, delivers replies)

Related issues

  • #56492 — Root cause: Carbon Client constructor does not await async registerClient
  • #58290 — Same symptoms on v2026.3.28
  • #59820 — Same symptoms on v2026.4.1
  • #53039 — Attempted fix for Identify silent-drop race

Suggested fix

The registerClient call in the Carbon Client constructor needs to be awaited, or the gateway plugin needs a synchronous initialization path that does not depend on async I/O completing before the constructor returns.

extent analysis

TL;DR

The most likely fix is to await the registerClient call in the Carbon Client constructor to ensure the WebSocket handshake completes before proceeding.

Guidance

  • Verify that the issue is indeed caused by the un-awaited registerClient call by checking the startup logs with and without the --verbose flag.
  • Consider adding a synchronous initialization path to the gateway plugin that does not depend on async I/O completing before the constructor returns.
  • Test the fix by removing the --verbose flag and checking if the gateway still reaches READY state.
  • Review related issues (#56492, #58290, #59820, #53039) to ensure the fix addresses all known symptoms.

Example

No code snippet is provided as the issue is related to the internal implementation of the @buape/carbon gateway plugin.

Notes

The provided workaround using the --verbose flag is not a permanent solution and may have performance implications. A proper fix should be implemented to ensure the gateway plugin initializes correctly.

Recommendation

Apply the suggested fix by awaiting the registerClient call in the Carbon Client constructor, as this addresses the root cause of the issue and ensures the WebSocket handshake completes before proceeding.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING