openclaw - 💡(How to fix) Fix Discord Guilds intent missing - causes channels unresolved error [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#48969Fetched 2026-04-08 00:50:18
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
0
Author
Timeline (top)
commented ×2cross-referenced ×1

Discord bot fails to resolve channels, showing "channels unresolved: guild:XXX" error even when all privileged intents are enabled in the Discord Developer Portal.

Error Message

Discord bot fails to resolve channels, showing "channels unresolved: guild:XXX" error even when all privileged intents are enabled in the Discord Developer Portal.

Root Cause

OpenClaw's Discord implementation is missing the Guilds Gateway Intent, which is required to read channel/guild data.

Code Example

intents: z.object({
    presence: z.boolean().optional(),
    guildMembers: z.boolean().optional()
    // MISSING: guilds: z.boolean().optional()
}).strict().optional(),
RAW_BUFFERClick to expand / collapse

Description

Discord bot fails to resolve channels, showing "channels unresolved: guild:XXX" error even when all privileged intents are enabled in the Discord Developer Portal.

Root Cause

OpenClaw's Discord implementation is missing the Guilds Gateway Intent, which is required to read channel/guild data.

Missing in config schema (discord-CcCLMjHw.js:162363-162366):

intents: z.object({
    presence: z.boolean().optional(),
    guildMembers: z.boolean().optional()
    // MISSING: guilds: z.boolean().optional()
}).strict().optional(),

Missing in resolveDiscordPrivilegedIntentsFromFlags (discord-CcCLMjHw.js:134665-134675):

The function only resolves 3 privileged intents:

  • presence
  • guildMembers
  • messageContent

It's missing: guilds

Required Intents (per Discord.js docs)

According to Discord.js documentation and a Dev.to guide, the following intents are required:

  • GatewayIntentBits.Guilds - MISSING ← This is the bug!
  • GatewayIntentBits.GuildMessages (auto-enabled, not privileged)
  • GatewayIntentBits.MessageContent (present)
  • GatewayIntentBits.GuildMembers (present)

Expected Behavior

When the Guilds intent is enabled in the Discord Developer Portal, OpenClaw should request it when connecting to the Discord Gateway, allowing the bot to read channel data.

Actual Behavior

  • Users resolved successfully
  • Channels unresolved

Log shows: channels unresolved: guild:865854830488322068

Environment

  • OpenClaw version: 2026.3.12
  • Node.js: v22.22.0
  • OS: Windows_NT

Suggested Fix

  1. Add guilds to the intents config schema
  2. Add guilds to the resolveDiscordPrivilegedIntentsFromFlags function
  3. Include GatewayIntentBits.Guilds when constructing the intents array for the Discord client

References

extent analysis

Fix Plan

To resolve the issue, follow these steps:

  • Update the intents config schema to include guilds:
intents: z.object({
    presence: z.boolean().optional(),
    guildMembers: z.boolean().optional(),
    guilds: z.boolean().optional() // Add this line
}).strict().optional(),
  • Modify the resolveDiscordPrivilegedIntentsFromFlags function to include guilds:
function resolveDiscordPrivilegedIntentsFromFlags(flags) {
    const intents = [];
    if (flags.presence) intents.push(GatewayIntentBits.Guilds);
    if (flags.guildMembers) intents.push(GatewayIntentBits.GuildMembers);
    if (flags.messageContent) intents.push(GatewayIntentBits.MessageContent);
    if (flags.guilds) intents.push(GatewayIntentBits.Guilds); // Add this line
    return intents;
}
  • Ensure GatewayIntentBits.Guilds is included when constructing the intents array for the Discord client:
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds, // Make sure this is included
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.MessageContent
    ]
});

Verification

After applying these changes, verify that the bot can resolve channels by checking the logs for the channels unresolved error. If the issue is resolved, the error should no longer appear.

Extra Tips

  • Make sure to enable the Guilds intent in the Discord Developer Portal for your bot.
  • Refer to the Discord.js documentation for more information on Gateway Intents.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Discord Guilds intent missing - causes channels unresolved error [2 comments, 3 participants]