Range Error Shard 0 not found
I'm getting a shard 0 not found error on the live bot, but I can't seem to replicate it in my dev environments.
the full error is as follows:
RangeError: Shard 0 not found
at SimpleShardingStrategy.send (/opt/icarus/icarus5.5/node_modules/@discordjs/ws/dist/index.js:1205:13)
at WebSocketManager.send (/opt/icarus/icarus5.5/node_modules/@discordjs/ws/dist/index.js:1449:26)
at WebSocketShard.send (/opt/icarus/icarus5.5/node_modules/discord.js/src/client/websocket/WebSocketShard.js:227:22)
at /opt/icarus/icarus5.5/node_modules/discord.js/src/managers/GuildMemberManager.js:237:24
at new Promise (<anonymous>)
at GuildMemberManager._fetchMany (/opt/icarus/icarus5.5/node_modules/discord.js/src/managers/GuildMemberManager.js:235:12)
at GuildMemberManager.fetch (/opt/icarus/icarus5.5/node_modules/discord.js/src/managers/GuildMemberManager.js:207:31)
at testCakeDays (/opt/icarus/icarus5.5/modules/cake.js:90:55)
at Timeout.celebrate [as _onTimeout] (/opt/icarus/icarus5.5/modules/cake.js:11:5)
at listOnTimeout (node:internal/timers:573:17)
Message
Unhandled Rejection
the lines around cake.js:90:55 is as follows:
const guild = Module.client.guilds.cache.get(u.sf.guildname);
const now = u.moment(testDate);
if (!guild) return u.errorHandler(new Error("guildname is unavailable???"));
const members = testMember ?? await guild.members.fetch().catch(u.noop) ?? guild.members.cache;
2 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OP[email protected]
node version v21.7.3
it doesn't seem to be possible unless something really weird broke...
based on what I'm understanding of it, the main script initializes the bot and within that initialization it loads all the modules, and loads their clockwork, running this setinterval, and then on that next line in the main script it runs login. I am not sure if it is syncronous or not.
if it is asyncronous it may explain why on my machine it would log in before it calls the setInterval whereas on production it's speed is such that it calls setinterval before being logged in if such is the case.
just tested, if I put client.login() in a timeout in the main script then it sends a different error, its possible it is a part of the issue, but just doing that does not reproduce the error on my development instance.
also, for further info, I am restricted unable to access the production instance directly, I've got to figure out how to replicate it and/or fix it on my machine without having to do 25 tests on the production machine.
its the discord bot for another server I am in. I'm not even a mod in the server, but I am working on getting involved with the bot. the bot is sending this error and I've been asked to look into it. I am telling them about how I am unable to reproduce the error, and asking them to look into it further, but the person who actually hosts the machine with the bot only has a limited availability.
also, we found the very source of the error. there was another bot running on the same machine that was working, and then there was the one that was erroring. I don't know exactly how that caused it, but for future, could you handle errors like that with better error messages?