Discord channel plugin: bot stays offline in certain project directories
Summary
Discord channel plugin (plugin:discord@claude-plugins-official) bot connects to Gateway but stays offline when Claude Code is launched from certain project directories, while working perfectly from others.
Reproduction
- Run
claude --channels plugin:discord@claude-plugins-officialfrom directory A → bot goes online, DM works - Run the same command from directory B (different project under the same parent) → bot stays offline, DMs don't work
- Order doesn't matter — even starting from directory B first, bot stays offline
Environment
- macOS Darwin 24.6.0
- Claude Code (latest CLI)
- Discord plugin v0.0.4 (
claude-plugins-official) - Bun runtime
Investigation findings
- Same bot token — shared via
~/.claude/channels/discord/.env - Same plugin code — identical
server.ts(33340 bytes) - Token is valid —
GET /users/@meand/guildsboth return correct data via REST API - All Privileged Gateway Intents enabled (Presence, Server Members, Message Content)
- TCP connections appear established —
lsofshows ESTABLISHED connections to Discord Gateway IPs (162.159.x.x) - But MCP
fetch_messagesreturns "Missing Access" — suggesting Gateway READY event never fires, soclient.channels.fetch()fails - Standalone test works — running
client.login()+ listening forreadyevent directly withbun -esucceeds from the same directory - Directory B had no
.claude/settings.local.jsoninitially (directory A did), but creating one didn't fix the issue
Hypothesis
Something in how Claude Code spawns/manages the MCP channel subprocess differs based on project context (working directory, project settings presence, or session state), causing the Discord.js Gateway handshake to not complete properly — even though the underlying TCP connection is established.
Additional note
During debugging, multiple zombie bun server.ts processes (CPU 85-95% each) were discovered running in the background, possibly from previous sessions that didn't clean up properly. These may have contributed to Gateway connection contention, but the issue persists even after killing all zombies and restarting cleanly.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗