[BUG] Discord channel plugin drops messages sent while Claude Code is restarting
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Problem
The Discord channel plugin (plugin:discord@claude-plugins-official) drops all messages sent while no Claude Code session is
running. After restarting Claude Code, messages sent during the downtime are never processed — there is no catch-up mechanism.
Expected behavior
When Claude Code starts and the Discord bot connects, it should fetch recent messages from monitored channels and DMs (using
discord.js's channel.messages.fetch()) and process any that arrived while the bot was offline. This is standard behavior for
chat bots that may restart.
Current behavior
The plugin only listens via client.on('messageCreate') (server.ts:802), which is a real-time event — it only fires for
messages received while the bot is connected. The client.once('ready') handler (server.ts:886) only logs "gateway connected as
{tag}" and does nothing else.
Result: Any message sent to the bot (DM or channel mention) during a restart window is silently lost.
Steps to reproduce
- Start Claude Code with Discord channel enabled
- Verify the bot responds to a message
- Quit Claude Code (bot goes offline)
- Send a message to the bot via DM or mention it in a guild channel
- Restart Claude Code
- The message from step 4 is never delivered to the session
Suggested fix
In the client.once('ready') handler, after login:
- For each guild channel in access.json groups: fetch recent messages (e.g., last 5 minutes or since last known message ID)
via channel.messages.fetch({ limit: N })
- For each approved DM user: fetch recent DMs similarly
- Filter to messages from allowed senders that were sent after the bot's last known online timestamp
- Process them through the existing dispatch() pipeline
The bot could persist its last-seen message ID (or last-online timestamp) to a file in ~/.claude/channels/discord/ to know the
catch-up window.
Environment
- Claude Code version: v2.1.x (latest)
- Discord plugin version: 0.0.4
- OS: macOS 26.3.1 (a)
- Runtime: Bun
What Should Happen?
Messages should be processed after restarting Claude Code.
Error Messages/Logs
Steps to Reproduce
- Start Claude Code with the Discord channel enabled
- Send a message to the bot (DM or channel mention) — verify it responds
- Quit Claude Code (/exit or Ctrl+C)
- While Claude Code is stopped, send one or more messages to the bot (DM and/or channel mention)
- Restart Claude Code — the Discord bot reconnects
- The messages from step 4 are never delivered to the session — no response is sent
Variant (restart gap): Even a brief restart (e.g., /exit then immediately relaunch) is enough to lose messages if any arrive
during the ~5-10 second window where the bot is disconnected.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.83
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗