modmailbot icon indicating copy to clipboard operation
modmailbot copied to clipboard

Bot occasionally crashes with invalid channel ID: undefined

Open CyberFlameGO opened this issue 1 year ago • 8 comments

Hi!! I'm encountering some crashes whilst running the bot - any help in fixing this (past validating that the getOrFetchChannel parameter isn't undefined) would be lovely!

Here are some stacktraces if that helps things

Error: Error: Invalid channel ID: undefined
    at Client.getChannel (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/Client.js:2447:13)
    at new Message (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/structures/Message.js:65:33)
    at /home/ubuntu/discord/modmailbot/node_modules/eris/lib/structures/Message.js:94:21
    at Array.map (<anonymous>)
    at new Message (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/structures/Message.js:85:54)
    at Collection.add (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/util/Collection.js:61:13)
    at Shard.wsEvent (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/gateway/Shard.js:946:55)
    at Shard.onPacket (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/gateway/Shard.js:398:16)
    at Shard._onWSMessage (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/gateway/Shard.js:2583:21)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (/home/ubuntu/discord/modmailbot/node_modules/ws/lib/websocket.js:1220:20)
    at Receiver.emit (node:events:518:28)
    at Receiver.dataMessage (/home/ubuntu/discord/modmailbot/node_modules/ws/lib/receiver.js:596:14)
    at Receiver.getData (/home/ubuntu/discord/modmailbot/node_modules/ws/lib/receiver.js:496:10)
    at Receiver.startLoop (/home/ubuntu/discord/modmailbot/node_modules/ws/lib/receiver.js:167:16)
    at Receiver._write (/home/ubuntu/discord/modmailbot/node_modules/ws/lib/receiver.js:94:10)
Error: Error: Invalid channel ID: undefined
    at Client.getChannel (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/Client.js:2447:13)
    at new Message (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/structures/Message.js:65:33)
    at Collection.add (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/util/Collection.js:61:13)
    at Collection.update (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/util/Collection.js:35:19)
    at /home/ubuntu/discord/modmailbot/node_modules/eris/lib/structures/Message.js:92:38
    at Array.map (<anonymous>)
    at new Message (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/structures/Message.js:85:54)
    at Collection.add (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/util/Collection.js:61:13)
    at Collection.update (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/util/Collection.js:35:19)
    at new Message (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/structures/Message.js:119:51)
    at Collection.add (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/util/Collection.js:61:13)
    at Shard.wsEvent (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/gateway/Shard.js:946:55)
    at Shard.onPacket (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/gateway/Shard.js:398:16)
    at Shard._onWSMessage (/home/ubuntu/discord/modmailbot/node_modules/eris/lib/gateway/Shard.js:2583:21)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (/home/ubuntu/discord/modmailbot/node_modules/ws/lib/websocket.js:1220:20)

CyberFlameGO avatar Nov 07 '24 15:11 CyberFlameGO

Hi, also getting this issue frequently! Just bumping so it gets more attention. :)

squidistaken avatar Dec 09 '24 10:12 squidistaken

same here! this is all the error logs I could retrieve

Error: Error: Invalid channel ID: undefined at Client.getChannel (/home/ubuntu/modmail/modmailbot-3.8.0/node_modules/eris/lib/Client.js:2447:13) at new Message (/home/ubuntu/modmail/modmailbot-3.8.0/node_modules/eris/lib/structures/Message.js:65:33) at /home/ubuntu/modmail/modmailbot-3.8.0/node_modules/eris/lib/structures/Message.js:94:21 at Array.map (<anonymous>) at new Message (/home/ubuntu/modmail/modmailbot-3.8.0/node_modules/eris/lib/structures/Message.js:85:54) at Collection.add (/home/ubuntu/modmail/modmailbot-3.8.0/node_modules/eris/lib/util/Collection.js:61:13) at Shard.wsEvent (/home/ubuntu/modmail/modmailbot-3.8.0/node_modules/eris/lib/gateway/Shard.js:946:55) ...stack trace truncated to 8 lines

M4R70 avatar Dec 21 '24 17:12 M4R70

Same problem, it happens that the bot crashes several times in an hour.

Nathack-dev avatar Dec 29 '24 22:12 Nathack-dev

From my (very limited) testing, the bot crashes since it tries to fetch the channel of a forwarded message from a server the bot isn't in.

Can someone confirm my theory? It also appears that forwarded messages (regardless if the bot is in the server or not) just don't show up in the inbox thread/logs 🤔

rubyowo avatar Dec 30 '24 06:12 rubyowo

Seems that eris already has an open PR to fix this: https://github.com/abalabahaha/eris/pull/1582

rubyowo avatar Dec 30 '24 06:12 rubyowo

From my (very limited) testing, the bot crashes since it tries to fetch the channel of a forwarded message from a server the bot isn't in.

Can someone confirm my theory? It also appears that forwarded messages (regardless if the bot is in the server or not) just don't show up in the inbox thread/logs 🤔

I can replicate this. Seems like this is the case?

squidistaken avatar Feb 02 '25 12:02 squidistaken

In my testing, this happens regardless of whether or not the bot can access the server or channel. It just implodes immediately upon seeing any forwarded message.

J0w03L avatar Feb 03 '25 15:02 J0w03L

Bump? Someone have the fix?

0xDevelopperPrivate avatar Jun 12 '25 18:06 0xDevelopperPrivate