Skip to content

Bot crashes if it receives ANY forwarded message #827

@horouuu

Description

@horouuu

Details

Modmail v3.8.0 (6dd7e4a)

Description & Reproducing the Bug

As the title says, when you forward ANY message, the bot crashes.

Edited after further examination: I am able to force my server's bot to crash just by forwarding a message to it. It does not crash when attempting to recover forwarded messages, but every new forwarded message will crash the bot.

Stacktrace

On new forwarded message:

Error: Error: Invalid channel ID: undefined
    at Client.getChannel (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\Client.js:2447:13)
    at new Message (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\structures\Message.js:65:33)
    at C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\structures\Message.js:94:21
    at Array.map (<anonymous>)
    at new Message (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\structures\Message.js:85:54)
    at Shard.wsEvent (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\gateway\Shard.js:948:38)
    at Shard.onPacket (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\gateway\Shard.js:398:16)
    ...stack trace truncated to 8 lines

On recovery:

Error: Invalid channel ID: undefined
    at Client.getChannel (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\Client.js:2447:13)
    at new Message (C:\Users\Horou\Documents\GitHub\-l\node_modules\eris\lib\structures\Message.js:65:33)
    at C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\structures\Message.js:94:21
    at Array.map (<anonymous>)
    at new Message (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\structures\Message.js:85:54)
    at C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\Client.js:2993:16
    at Array.map (<anonymous>)
    at Client.getMessages (C:\Users\Horou\Documents\GitHub\-\node_modules\eris\lib\Client.js:2991:21)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Thread.recoverDowntimeMessages (C:\Users\Horou\Documents\GitHub\-\src\data\Thread.js:1215:21)
    at async Client.<anonymous> (C:\Users\Horou\Documents\GitHub\-\src\main.js:90:11)

Notes

I think this is probably a byproduct of the new forwarded message functionality. Regardless, it isn't hard to patch out on our side, but I thought I'd let you know that a crtiical bug may exist.

Upon further inspection, this seems to be a bug inside the Eris message listener. If it tries to create a new Message object with a forwarded message, it'll end up throwing a chain of errors which crashes the process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions