guild.channels.set(channel.id, channel) Cannot read property 'id' of undefined

Viewed 2344

As of very recent, some Discord.js users are now running into these errors:

guild.channels.set(channel.id, channel);
                                   ^

TypeError: Cannot read property 'id' of undefined
bughunter Bug:
node_modules\discord.js\src\client\voice\networking\VoiceWebSocket.js:123
server_id: this.connection.channel.guild.id,
                                   ^
TypeError: Cannot read property 'guild' of undefined

Read the provided answer below.

1 Answers

Solution: Update Discord.js to v12

Why does this error occur?
Your bot encountered a Stage Channel, Discord.js v11 does not - and will not - support stage channels. This is essentially the end of the road for v11.

Statement by Discord.js maintainers

Version 11 will hard crash if it encounters a stage channel
• we will not fix this
• please update your bot to version 12 https://v12.discordjs.guide/additional-info/changes-in-v12.html#before-you-start
• reminder: logging in with a user token is against discord terms of service and we fully dropped support for user accounts in version 12.

Related