discord.js: bot crashes with uncatchable error from members.fetch
Please describe the problem you are having in as much detail as possible:
When running message.guild.members.fetch({ user: [] })
with an invalid snowflake like a
ex message.guild.members.fetch({ user: ['a', '1'] })
it seems to crash the node process without any errors. Even a catch doesn’t handle it since there’s no error thrown. Then after exactly 120 seconds the bot makes a successful connection to the gateway in which it then throws the error but the node process is still in a crashed state in which the bot never fully reconnected. I do use PM2 so pm2 is configured to restart a crashed node process. Though the process isn’t fully crashed. The only thing that’s emitted in the console is from the Shard reconnect event right when the bot goes offline.
You can view the video I recorded of it happening here https://streamable.com/f3y0mm once you reach the 11 second mark you can skip the video to the 2 minute mark, everything between that is just untrimmed video of it showing it’s still offline. But at the 2:11 mark you can see the bot throws the error but is still offline.
With the debug logs enabled this is all that’s emitted
[2020-10-08 17:03:12] [WS => Shard 0] [INVALID SESSION] Resumable: false.
[2020-10-08 17:03:12] [SHARD RECONNECTING] Shard 0
Include a reproducible code sample here, if possible:
message.guild.members.fetch({ user: ['a', '1'] })
Further details:
- discord.js version: master
- Node.js version: v14.12.0
- Operating system: Ubuntu 18.04
- Priority this issue should have – please be realistic and elaborate if possible: medium-high. Medium since you shouldn’t be providing invalid snowflakes anyways and high since it causes a crash/delay that has no way of handling it.
Relevant client options:
- partials: none
- gateway intents: none
- other: none
- I have also tested the issue on latest master, commit hash: d234165
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- fix(WebSocketManager): reconnect on INVALID_SESSION (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
- feat(Snowflake): add .maybeSnowflake() (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
- feat(Base): add .isValidID() (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
- feat(BaseManager): make use of Base.isValidID() in #resolveID (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
- feat(Snowflake): add .maybeSnowflake() (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
- feat(Base): add .isValidID() (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
- feat(BaseManager): make use of Base.isValidID() in #resolveID (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
- docs(Base): document .isValidID (#4896) — committed to TeeSeal/discord.js by deleted user 4 years ago
discord.js is a totally buggy library I stopped using it there are too many concerns and the community does not have the skills.
I wasted way too much time with them I advise you to use something else.
Seems like an intents issue, see the guide regarding gateway intents.
Looks Legit