Announcement/public thread channels can sometimes cause GUILD_CREATE handler to fail
Closed this issue · 1 comments
I occasionally see this error pop up in logs when starting my bot. Running it standalone results in a crash, but running it in PM2 causes it to keep running after this:
TypeError: Cannot read properties of undefined (reading 'archive_timestamp')
at new ThreadChannel (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/structures/ThreadChannel.js:46:61)
at new AnnouncementThreadChannel (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/structures/AnnouncementThreadChannel.js:9:9)
at Map.update (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/util/TypedCollection.js:54:29)
at new Guild (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/structures/Guild.js:214:37)
at Map.update (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/util/TypedCollection.js:54:29)
at Shard.createGuild (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/gateway/Shard.js:146:42)
at Shard.onDispatch (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/gateway/Shard.js:300:40)
at Shard.onPacket (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/gateway/Shard.js:1044:27)
at Shard.onWSMessage (/home/esmBot/esmBot/node_modules/.pnpm/oceanic.js@1.5.2-dev.df03c89_bufferutil@4.0.7/node_modules/oceanic.js/dist/lib/gateway/Shard.js:1229:29)
at WebSocket.emit (node:events:513:28)
Since it seems to mostly occur on startup before the ready
event, I'd imagine that it might be due to some missing/uncached data. After some attempts to debug the issue, it seems like a PublicThreadChannel
is being passed into the data
field of the ThreadChannel
constructor. Will keep looking into this.
For reference, the translated stack trace
Oceanic/lib/structures/ThreadChannel.ts
Line 66 in df03c89
Oceanic/lib/util/TypedCollection.ts
Line 59 in df03c89
Oceanic/lib/structures/Guild.ts
Line 308 in df03c89
Oceanic/lib/util/TypedCollection.ts
Line 59 in df03c89
Line 186 in df03c89
Line 365 in df03c89
Line 1184 in df03c89
Line 1385 in df03c89