Closed JMTK closed 2 months ago
Stack trace from another crash
/app/node_modules/discord.js/src/client/actions/Action.js:27
return this.client.options.partials.includes(partialType) ? manager._add(data, cache) : manager.cache.get(id);
^
TypeError: Cannot read properties of undefined (reading 'get')
at ThreadMembersUpdateAction.getPayload (/app/node_modules/discord.js/src/client/actions/Action.js:27:107)
at ThreadMembersUpdateAction.getThreadMember (/app/node_modules/discord.js/src/client/actions/Action.js:112:17)
at /app/node_modules/discord.js/src/client/actions/ThreadMembersUpdate.js:22:35
at Array.reduce (<anonymous>)
at ThreadMembersUpdateAction.handle (/app/node_modules/discord.js/src/client/actions/ThreadMembersUpdate.js:21:32)
at module.exports [as THREAD_MEMBERS_UPDATE] (/app/node_modules/discord.js/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js:4:38)
at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12)
at WebSocketManager.emit (/app/node_modules/@vladfrangu/async_event_emitter/src/index.ts:459:28)
at WebSocketShard.<anonymous> (/app/node_modules/@discordjs/ws/src/strategies/sharding/SimpleShardingStrategy.ts:32:47)
Stack trace from another crash
/app/node_modules/discord.js/src/client/actions/Action.js:27 return this.client.options.partials.includes(partialType) ? manager._add(data, cache) : manager.cache.get(id); ^ TypeError: Cannot read properties of undefined (reading 'get') at ThreadMembersUpdateAction.getPayload (/app/node_modules/discord.js/src/client/actions/Action.js:27:107) at ThreadMembersUpdateAction.getThreadMember (/app/node_modules/discord.js/src/client/actions/Action.js:112:17) at /app/node_modules/discord.js/src/client/actions/ThreadMembersUpdate.js:22:35 at Array.reduce (<anonymous>) at ThreadMembersUpdateAction.handle (/app/node_modules/discord.js/src/client/actions/ThreadMembersUpdate.js:21:32) at module.exports [as THREAD_MEMBERS_UPDATE] (/app/node_modules/discord.js/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js:4:38) at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31) at WebSocketManager.<anonymous> (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12) at WebSocketManager.emit (/app/node_modules/@vladfrangu/async_event_emitter/src/index.ts:459:28) at WebSocketShard.<anonymous> (/app/node_modules/@discordjs/ws/src/strategies/sharding/SimpleShardingStrategy.ts:32:47)
Do you by any chance have any custom makeCache:
settings in your Client constructor? Because if your crash has the same reason as OP's it would mean you have a <Guild>.members.cache._add
method defined, which regular Collection
from discord.js doesn't have.
I do not: https://github.com/DawnbrandBots/emcee-tournament-bot/blob/master/src/index.ts#L28-L39
I have that on a different bot but that bot has yet to crash because of this despite being in exponentially more servers.
I do not: https://github.com/DawnbrandBots/emcee-tournament-bot/blob/master/src/index.ts#L28-L39
I have that on a different bot but that bot has yet to crash because of this despite being in exponentially more servers.
Then linking to the code of the bot that didn't crash won't help much in determining the cause... or did you mean you have makeCache on another bot that doesn't crash, but this one you linked is the one that crashed with said error?
Ah, my bad, it's literally the difference of it you have Partials.ThreadMember
enabled or not that decides which of them errors.
Which package is this bug report for?
discord.js
Issue description
Creating this issue for posterity, bulk of the discussion and fix were noted here: https://discord.com/channels/222078108977594368/1248260322163294238
After a recent update to @discordjs/ws, it seems like Messages are being instantiated as channels in some very specific cases.
Full trace of the issue is here:
Sample "TextChannel" that is actually a "thread":
(Note the
memberCount
property here means we know it's a thread)I think the possible problem commit was: https://github.com/discordjs/discord.js/pull/10278
Code sample
Versions
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
User, Channel, GuildMember, Message, Reaction, ThreadMember
Which gateway intents are you subscribing to?
Guilds, GuildMembers, GuildPresences, GuildMessages, DirectMessages
I have tested this issue on a development release
No response