Message.startThread fails with: DiscordAPIError[10008]: Unknown Message

I'm sending a message to the channel using channel.send, awaiting it and saving it to a variable called sentMessage. Then executing .startThread() but it fails with:
ode:events:497
throw er; // Unhandled 'error' event
^

DiscordAPIError[10008]: Unknown Message
at handleErrors (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildTextThreadManager.create (/home/baran-mordo-an/vote/node_modules/.pnpm/discord.js@14.15.3/node_modules/discord.js/src/managers/GuildTextThreadManager.js:76:18)
at async Object.execute (/home/baran-mordo-an/vote/events/messageCreate.js:78:20)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: undefined,
json: {
name: 'food-talk',
auto_archive_duration: 60,
type: 11,
invitable: undefined,
rate_limit_per_user: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1275894957969772725/messages/1275897984210567199/threads'
ode:events:497
throw er; // Unhandled 'error' event
^

DiscordAPIError[10008]: Unknown Message
at handleErrors (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/home/baran-mordo-an/vote/node_modules/.pnpm/@discordjs+rest@2.3.0/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildTextThreadManager.create (/home/baran-mordo-an/vote/node_modules/.pnpm/discord.js@14.15.3/node_modules/discord.js/src/managers/GuildTextThreadManager.js:76:18)
at async Object.execute (/home/baran-mordo-an/vote/events/messageCreate.js:78:20)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: undefined,
json: {
name: 'food-talk',
auto_archive_duration: 60,
type: 11,
invitable: undefined,
rate_limit_per_user: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1275894957969772725/messages/1275897984210567199/threads'
Here's the code:
const sentMessage = await message.channel.send(toSend);

// create thread
const thread = await message.startThread({
name: "food-talk",
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: "Needed a separate thread for food",
});
const sentMessage = await message.channel.send(toSend);

// create thread
const thread = await message.startThread({
name: "food-talk",
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: "Needed a separate thread for food",
});
4 Replies
d.js toolkit
d.js toolkit3mo 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
okunamayanad
okunamayanadOP3mo ago
npm list discord.js
[email protected] /home/baran-mordo-an/vote
└── [email protected] -> ./node_modules/.pnpm/[email protected]/node_modules/discord.js
[email protected] /home/baran-mordo-an/vote
└── [email protected] -> ./node_modules/.pnpm/[email protected]/node_modules/discord.js
node -v
v20.15.0
v20.15.0
treble/luna
treble/luna3mo ago
you call it on message not on sentMessage
okunamayanad
okunamayanadOP3mo ago
ohhh so sorry, didn't notice that thanks for pointing it out
Want results from more Discord servers?
Add your server