TypeError: Cannot read properties of undefined (reading 'id')

hey i am trying to make a bot that shows fivem server population on discord but i keep running into this error on my second bot on different discord server.
PS C:\Users\LMAO\Desktop\bot3> npm start

> node ./index.js

Attempting to load enviroment
Starting bot
C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\ClientDataManager.js:81
guild.channels.set(channel.id, channel);
^

TypeError: Cannot read properties of undefined (reading 'id')
at ClientDataManager.newChannel (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\ClientDataManager.js:81:36)
at Guild.setup (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\structures\Guild.js:307:68)
at GuildCreateHandler.handle (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:12:15)
at WebSocketPacketManager.handle (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
at WebSocketConnection.onPacket (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
at WebSocketConnection.onMessage (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
at WebSocket.onMessage (C:\Users\LMAO\Desktop\bot3\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (node:events:514:28)
at Receiver.receiverOnMessage (C:\Users\LMAO\Desktop\bot3\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (node:events:514:28)
PS C:\Users\LMAO\Desktop\bot3> npm start

> node ./index.js

Attempting to load enviroment
Starting bot
C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\ClientDataManager.js:81
guild.channels.set(channel.id, channel);
^

TypeError: Cannot read properties of undefined (reading 'id')
at ClientDataManager.newChannel (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\ClientDataManager.js:81:36)
at Guild.setup (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\structures\Guild.js:307:68)
at GuildCreateHandler.handle (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:12:15)
at WebSocketPacketManager.handle (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
at WebSocketConnection.onPacket (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
at WebSocketConnection.onMessage (C:\Users\LMAO\Desktop\bot3\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
at WebSocket.onMessage (C:\Users\LMAO\Desktop\bot3\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (node:events:514:28)
at Receiver.receiverOnMessage (C:\Users\LMAO\Desktop\bot3\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (node:events:514:28)
No description
No description
9 Replies
d.js toolkit
d.js toolkit14mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
! Arya
! AryaOP14mo ago
11.6.4 and v20.8.0
Danial
Danial14mo ago
You're on v11?
! Arya
! AryaOP14mo ago
yeah thats what it shows unless i am wrong
No description
! Arya
! AryaOP14mo ago
pretty new to this
chewie
chewie14mo ago
update lol we are at 14.13.x
! Arya
! AryaOP14mo ago
oh i dont wanna be rude but can u please give me the line for it
chewie
chewie14mo ago
https://v12.discordjs.guide/additional-info/changes-in-v12.html https://discordjs.guide/additional-info/changes-in-v13.html https://discordjs.guide/additional-info/changes-in-v14.html npm uninstall @discordjs/builders @discordjs/formatters @discordjs/rest discord-api-types discord.js npm i discord.js@latest
! Arya
! AryaOP14mo ago
thank you!
Want results from more Discord servers?
Add your server