TypeError: Cannot read property ‘id’ of undefined at ClientDataManager.newChannel ClientDataManager.js:81:36

my node.js discord bot (discord.js based) suddenly shut down an hour ago and now produces an error on startup.

Bot started!

Found 3 commands, loading.

/var/www/bot/live/node_modules/discord.js/src/client/ClientDataManager.js:81
        guild.channels.set(channel.id, channel);
                                   ^

TypeError: Cannot read property 'id' of undefined
    at ClientDataManager.newChannel (/var/www/bot/live/node_modules/discord.js/src/client/ClientDataManager.js:81:36)
    at Guild.setup (/var/www/bot/live/node_modules/discord.js/src/structures/Guild.js:307:68)
    at GuildCreateHandler.handle (/var/www/bot/live/node_modules/discord.js/src/client/websocket/packets/handlers/GuildCreate.js:12:15)
    at WebSocketPacketManager.handle (/var/www/bot/live/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (/var/www/bot/live/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (/var/www/bot/live/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
    at WebSocket.onMessage (/var/www/bot/live/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (/var/www/bot/live/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:315:20)

This is all I see. The script does the whole loading method and then just crashes. And I’m not even using any channel info.

Any idea what this could be?

There have not been any updates. The server and bot wasn’t touched for a month and worked flawless.

Answer

I have experienced the same problem.

It seems that the issue is caused by the new “Stage channels” feature because deleting it on my serer solved the problem for me and my bot started fine. But I am a newbie so I am not sure if it’s possible to fix it within the code.

Leave a Reply

Your email address will not be published. Required fields are marked *