Which package is this bug report for?
discord.js
Issue description
During sharding reconnection, if the bot leaves the guild, the guild will remain in the cache when the session is resumed.
I discovered this bug back on February 27, 2026, but because I was using my library, I only fixed this bug for myself.
Steps:
- Wait for the ClientReady event
- Turn off the Internet
- Remove the app from the guild
- Turn on the Internet
- Wait for the ClientReady event
Code sample
client.on(Events.ClientReady, (client) => {
console.log(`Ready. ${client.guilds.cache.size} guilds`)
})
client.on(Events.GuildCreate, (guild) => {
console.log(`Guild create ${guild.name}`)
})
client.on(Events.GuildDelete, (guild) => {
console.log(`Guild delete ${guild.name}`)
})
Versions
Nodejs v24.15.0
Discord.js dev, see below
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds
I have tested this issue on a development release
3d61215
Which package is this bug report for?
discord.js
Issue description
During sharding reconnection, if the bot leaves the guild, the guild will remain in the cache when the session is resumed.
I discovered this bug back on February 27, 2026, but because I was using my library, I only fixed this bug for myself.
Steps:
Code sample
Versions
Nodejs v24.15.0
Discord.js dev, see below
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds
I have tested this issue on a development release
3d61215