[BUG] Discord plugin: DM channels in access.groups fail allowlist check intermittently

Resolved 💬 4 comments Opened Apr 6, 2026 by honicky Closed May 22, 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?

Bug: fetchAllowedChannel() in the Discord plugin checks DM channels only against access.allowFrom using ch.recipientId, but DM channels can also be stored in access.groups by channel ID (e.g., after pairing). When Discord.js identifies a channel as ChannelType.DM, the groups check is skipped entirely, causing "not allowlisted" errors even though the channel is configured.

What Should Happen?

Fix: Check id in access.groups before the DM/non-DM branch:

// Before (broken for DMs in groups):
if (ch.type === ChannelType.DM) {
if (access.allowFrom.includes(ch.recipientId)) return ch
} else {
const key = ch.isThread() ? ch.parentId ?? ch.id : ch.id
if (key in access.groups) return ch
}

// After (works):
if (id in access.groups) {
const ch = await fetchTextChannel(id)
return ch
}
// ...then fall through to existing DM/thread checks
File: server.ts in discord plugin (line ~403)

Error Messages/Logs

"channel X is not allowlisted — add via /discord:access"

Steps to Reproduce

  1. Pair a DM channel via /discord:access
  2. The channel ID gets stored in access.json under groups
  3. After some time, reply and fetch_messages fail with "channel X is not allowlisted — add via /discord:access"
  4. The access.json file still correctly contains the channel under groups

Claude Model

Sonnet (default)

Is this a regression?

Not sure

Last Working Version

_No response_

Claude Code Version

2.1.92 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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