DiscordAPIError[50001]: Missing Access. In private threads

I am trying to create a MessageComponentCollector for an interaction Command. It works fine in private channels but in threads started inside those channels the interaction.channel property is null and trying to fetch the channel leads to a DiscordAPIError for missing access. While I would say that the bot just cannot access that channel the interaction command works fine and in discord.js v13 fetching the threads also worked, as the bots were previously working fine in those threads before I updated to v14. So I am thinking it might be a bug in Discord.js v14 You can reproduce this by starting a private channel then creating a thread (private or not, doesn't matter) from this channel. Then trying to fetch that thread while using an interaction command from inside the thread. interaction.client.channels.fetch(interaction.channelId); Stack Trace
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (/home/bot/Realm-of-Darkness-Bot/node_modules/@discordjs/rest/dist/index.js:933:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (/home/bot/Realm-of-Darkness-Bot/node_modules/@discordjs/rest/dist/index.js:712:14)
at async REST.request (/home/bot/Realm-of-Darkness-Bot/node_modules/@discordjs/rest/dist/index.js:1321:22)
at async ChannelManager.fetch (/home/bot/Realm-of-Darkness-Bot/node_modules/discord.js/src/managers/ChannelManager.js:123:18)
at async handleRerollPress (/home/bot/Realm-of-Darkness-Bot/modules/dice/5th/handleRerollPress.js:16:18)
at async vtmRoll (/home/bot/Realm-of-Darkness-Bot/modules/dice/5th/vtmRoll.js:18:3)
at async Object.execute (/home/bot/Realm-of-Darkness-Bot/commands/5th/vtmDice.js:18:16)
at async Object.execute (/home/bot/Realm-of-Darkness-Bot/events/interactionCreate.js:22:31)
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (/home/bot/Realm-of-Darkness-Bot/node_modules/@discordjs/rest/dist/index.js:933:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (/home/bot/Realm-of-Darkness-Bot/node_modules/@discordjs/rest/dist/index.js:712:14)
at async REST.request (/home/bot/Realm-of-Darkness-Bot/node_modules/@discordjs/rest/dist/index.js:1321:22)
at async ChannelManager.fetch (/home/bot/Realm-of-Darkness-Bot/node_modules/discord.js/src/managers/ChannelManager.js:123:18)
at async handleRerollPress (/home/bot/Realm-of-Darkness-Bot/modules/dice/5th/handleRerollPress.js:16:18)
at async vtmRoll (/home/bot/Realm-of-Darkness-Bot/modules/dice/5th/vtmRoll.js:18:3)
at async Object.execute (/home/bot/Realm-of-Darkness-Bot/commands/5th/vtmDice.js:18:16)
at async Object.execute (/home/bot/Realm-of-Darkness-Bot/events/interactionCreate.js:22:31)
Discord.js v14.9.0 Node v18.15.0
1 Reply
d.js toolkit
d.js toolkit15mo 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.