#Discord issue

1 messages · Page 1 of 1 (latest)

vestal pasture
#

error gateway/channels/discord {"subsystem":"gateway/channels/discord"} discord gateway fatal: Error: Fatal gateway close code: 4004

noble carbonBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

cedar frigateBOT
#

4004 is Discord-side authentication failed — usually the bot token OpenClaw is using is wrong, revoked, or not actually available to the gateway process. This is not pairing yet; the Discord gateway can’t log in. (docs.discord.com)

First, please share:

openclaw --version
openclaw channels status --probe

Don’t paste your token here.

Fast fix path:

  1. Discord Developer Portal → your app → BotReset Token
  2. Make sure you copied the Bot Token — not Client Secret / App ID.
  3. Set it for OpenClaw and restart:
#
export DISCORD_BOT_TOKEN="YOUR_NEW_BOT_TOKEN"
openclaw config set channels.discord.token --ref-provider default --ref-source env --ref-id DISCORD_BOT_TOKEN
openclaw config set channels.discord.enabled true --strict-json
openclaw gateway restart

One gotcha: channels.discord.token in config wins over DISCORD_BOT_TOKEN, so a stale config token can keep breaking even if your env var is correct. OpenClaw Discord docs: (docs.openclaw.ai)

vestal pasture
#

can i just add DISCORD_BOT_TOKEN in .env and install openclaw it was working before update

cedar frigateBOT
#

Yes — but put it in the right .env.

For an installed/gateway service setup, use the global one:

mkdir -p ~/.openclaw
nano ~/.openclaw/.env

Add exactly one line:

DISCORD_BOT_TOKEN=your_new_bot_token_here

Then make sure config points to that env var and restart:

#
openclaw config set channels.discord.token --ref-provider default --ref-source env --ref-id DISCORD_BOT_TOKEN
openclaw config set channels.discord.enabled true --strict-json
openclaw doctor
openclaw gateway restart
openclaw channels status --probe

A project-local .env only works if the gateway is started from that current directory, so after an update/service install it’s easy for that to stop being true. ~/.openclaw/.env is the safer place.

Also: if it still shows 4004, paste:

openclaw --version
openclaw channels status --probe