[BUG] Discord channel plugin drops messages sent while Claude Code is restarting

Resolved 💬 2 comments Opened Mar 25, 2026 by pcrausaz Closed Apr 24, 2026

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

  1. Start Claude Code with Discord channel enabled
  2. Verify the bot responds to a message
  3. Quit Claude Code (bot goes offline)
  4. Send a message to the bot via DM or mention it in a guild channel
  5. Restart Claude Code
  6. The message from step 4 is never delivered to the session

Suggested fix

In the client.once('ready') handler, after login:

  1. 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 })

  1. For each approved DM user: fetch recent DMs similarly
  2. Filter to messages from allowed senders that were sent after the bot's last known online timestamp
  3. 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

  1. Start Claude Code with the Discord channel enabled
  2. Send a message to the bot (DM or channel mention) — verify it responds
  3. Quit Claude Code (/exit or Ctrl+C)
  4. While Claude Code is stopped, send one or more messages to the bot (DM and/or channel mention)
  5. Restart Claude Code — the Discord bot reconnects
  6. 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_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗