Discord · 10008
Discord error 10008: Unknown Message
Your bot asked Discord about a message that no longer exists. It was deleted — by a user, a moderator, or another bot — between the moment your bot saw it and the moment it acted.
What you are seeing
discord.js
DiscordAPIError[10008]: Unknown Messagediscord.py
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown MessageWhat it means
A message ID is only good while the message exists. Editing it, deleting it, adding a reaction to it, or fetching it after it has been deleted all fail with 10008. The same error appears if the ID is looked up in the wrong channel: the message has to be in the channel you ask about.
It is a race, most of the time. A moderation command that deletes a message your bot was about to edit, a user who deletes their message while a command runs, a reaction added to a message that vanished a second earlier — all of these are ordinary, and none of them means your code is wrong.
Handle it, do not crash on it
A bot that keeps a message up to date — a stats board, a giveaway, a queue — will meet this whenever a moderator deletes that message. The right response is to treat "gone" as a state, not an error: send a fresh message and remember the new ID, or stop tracking the old one. Our own public stats message works this way: if a moderator deletes it, the next update posts a new one instead of failing.
discord.js
try {
await message.edit(newContent);
} catch (error) {
if (error.code === 10008) {
// The message was deleted. Post a fresh one and remember its ID.
message = await channel.send(newContent);
} else {
throw error;
}
}discord.py
try:
await message.edit(content=new_content)
except discord.NotFound:
# The message was deleted. Post a fresh one and remember its ID.
message = await channel.send(new_content)FAQ
Questions
It happens every time, not sometimes.
Then the stored message ID is stale: the message was deleted and nothing re-created it. Check the channel by hand; if the message is not there, send a new one and store its ID.
Is 10008 the same as 10003 Unknown Channel?
No. 10003 means the channel is gone; 10008 means the message is gone. If the whole channel was deleted, expect 10003 instead.
Can I check a message still exists without fetching it?
No — fetching it is the check. Keep the IDs you need, fetch them when you act, and treat "not found" as the answer, not a failure.
Read next