why am I getting this error sometimes even though the code works perfectly fine?

I have a confessions system set up for my server and it works fine but at times it doesn’t work and keeps sending this error. What does it mean and how do I fix it? Or do I just ignore it?
Traceback (most recent call last):
File "/app/bobert/plugins/listeners/confess.py", line 99, in on_message
await message.delete()
File "/opt/venv/lib/python3.9/site-packages/hikari/messages.py", line 1079, in delete
await self.app.rest.delete_message(self.channel_id, self.id)
File "/opt/venv/lib/python3.9/site-packages/hikari/impl/rest.py", line 1456, in delete_message
await self._request(route)
File "/opt/venv/lib/python3.9/site-packages/hikari/impl/rest.py", line 800, in _request
await self._handle_error_response(response)
File "/opt/venv/lib/python3.9/site-packages/hikari/impl/rest.py", line 822, in _handle_error_response
raise await net.generate_error_response(response)
hikari.errors.NotFoundError: Not Found 404: (10008) 'Unknown Message' for https://discord.com/api/v10/channels/806649868314869760/messages/1075282061469941820
Traceback (most recent call last):
File "/app/bobert/plugins/listeners/confess.py", line 99, in on_message
await message.delete()
File "/opt/venv/lib/python3.9/site-packages/hikari/messages.py", line 1079, in delete
await self.app.rest.delete_message(self.channel_id, self.id)
File "/opt/venv/lib/python3.9/site-packages/hikari/impl/rest.py", line 1456, in delete_message
await self._request(route)
File "/opt/venv/lib/python3.9/site-packages/hikari/impl/rest.py", line 800, in _request
await self._handle_error_response(response)
File "/opt/venv/lib/python3.9/site-packages/hikari/impl/rest.py", line 822, in _handle_error_response
raise await net.generate_error_response(response)
hikari.errors.NotFoundError: Not Found 404: (10008) 'Unknown Message' for https://discord.com/api/v10/channels/806649868314869760/messages/1075282061469941820
12 Replies
Percy
Percy2y ago
Project ID: N/A
Percy
Percy2y ago
No search results found.
⚠️ experimental feature
lucy💫
lucy💫2y ago
N/A
Brody
Brody2y ago
looks like you're trying to delete a message that doesn't exist or has already been deleted, but we would need to see some code to know what's going on
Brody
Brody2y ago
so someone sends a confession in the confession channel, you delete their message and send a confirmation. correct?
lucy💫
lucy💫2y ago
yes
Brody
Brody2y ago
and when the call to
message.delete()
message.delete()
on line 99 fails, it also fails to delete their message?
lucy💫
lucy💫2y ago
correct
Brody
Brody2y ago
call it a hunch, but you might be trying to delete the confession message too soon, you have already added a wait before deleting the confirmation message, try to send the confirmation message then delete the confession message
lucy💫
lucy💫2y ago
wym by that
Brody
Brody2y ago
await message.delete()
await message.delete()
that is the first function call you do in that event handler, sure you got the message but something might not have propagated through discords servers at the time of that function call
Want results from more Discord servers?
Add your server