[FIXED] TypeError (reading 'user') when creating threads

Started having this error pop up on two bots different bots starting around <t:1686789295>
TypeError: Cannot read properties of null (reading 'user')
at GuildMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildMemberManager.js:39:47)
at ThreadMember._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadMember.js:51:47)
at ThreadMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ThreadMemberManager.js:33:26)
at ThreadChannel._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadChannel.js:197:55)
at ChannelManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ChannelManager.js:42:27)
at ThreadCreateAction.handle (/home/pi/Desktop/yellow/node_modules/discord.js/src/client/actions/ThreadCreate.js:10:36)
at GuildTextThreadManager.create (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildTextThreadManager.js:87:45)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RaidCommandInteractionHopper.#process (/home/pi/Desktop/yellow/bot.js:3643:4)
TypeError: Cannot read properties of null (reading 'user')
at GuildMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildMemberManager.js:39:47)
at ThreadMember._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadMember.js:51:47)
at ThreadMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ThreadMemberManager.js:33:26)
at ThreadChannel._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadChannel.js:197:55)
at ChannelManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ChannelManager.js:42:27)
at ThreadCreateAction.handle (/home/pi/Desktop/yellow/node_modules/discord.js/src/client/actions/ThreadCreate.js:10:36)
at GuildTextThreadManager.create (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildTextThreadManager.js:87:45)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RaidCommandInteractionHopper.#process (/home/pi/Desktop/yellow/bot.js:3643:4)
Code:
await parentChannel.threads.create({ // line 3643
name,
type: ChannelType.PrivateThread,
invitable: false,
})
.catch(
// ...
await parentChannel.threads.create({ // line 3643
name,
type: ChannelType.PrivateThread,
invitable: false,
})
.catch(
// ...
On both bots this happens when creating private threads. No code has been updated for ~2 days and this function runs very frequently (edit: not specific to private threads)
13 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
edocsil
edocsilOP2y ago
The thread is created but then an error is thrown Seems to be happening on 3 different bot tokens across 2 machines. Both [email protected]
client.once(Events.ClientReady, async client => {
console.log("ready")

const channel = client.channels.cache.get("887784126713843803")
await channel.threads.create({
name: "test",
})
})
client.once(Events.ClientReady, async client => {
console.log("ready")

const channel = client.channels.cache.get("887784126713843803")
await channel.threads.create({
name: "test",
})
})
TypeError: Cannot read properties of null (reading 'user')
at GuildMemberManager._add (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\GuildMemberManager.js:39:47)
at ThreadMember._patch (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\structures\ThreadMember.js:51:47)
at ThreadMemberManager._add (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\ThreadMemberManager.js:33:26)
at ThreadChannel._patch (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\structures\ThreadChannel.js:197:55)
at ChannelManager._add (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\ChannelManager.js:42:27)
at ThreadCreateAction.handle (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\client\actions\ThreadCreate.js:10:36)
at GuildTextThreadManager.create (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\GuildTextThreadManager.js:87:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (C:\Users\****\OneDrive\Documents\Scripts\test-v14\test.js:41:2)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
TypeError: Cannot read properties of null (reading 'user')
at GuildMemberManager._add (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\GuildMemberManager.js:39:47)
at ThreadMember._patch (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\structures\ThreadMember.js:51:47)
at ThreadMemberManager._add (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\ThreadMemberManager.js:33:26)
at ThreadChannel._patch (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\structures\ThreadChannel.js:197:55)
at ChannelManager._add (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\ChannelManager.js:42:27)
at ThreadCreateAction.handle (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\client\actions\ThreadCreate.js:10:36)
at GuildTextThreadManager.create (C:\Users\****\OneDrive\Documents\Scripts\test-v14\node_modules\discord.js\src\managers\GuildTextThreadManager.js:87:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (C:\Users\****\OneDrive\Documents\Scripts\test-v14\test.js:41:2)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
edocsil
edocsilOP2y ago
Thanks, glad it's not just me
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
edocsil
edocsilOP2y ago
That's great. Thank you for doing that
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
edocsil
edocsilOP2y ago
I'm curious. Seemed like it was related to caching threads when added but didn't really dig into it
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
edocsil
edocsilOP2y ago
Thanks. Seems like a really minor difference at a glance but clearly it matters
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
edocsil
edocsilOP2y ago
Seems resolved for me too. Thanks shay
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server