Sharding Client To Long to be Ready Error

I am creating a Discord Bot using Discord.js v14.15.3. Along with Node.js v18.18.2. I am currently trying to implement sharding into the project, but I get his error message when ever I run the bot. I get this before the bot goes online. Error
Error [ShardingReadyTimeout]: Shard 0's Client took too long to become ready.
at Timeout.onTimeout (C:\Coding\BOTNAMEHERE\bot\node_modules\discord.js\src\sharding\Shard.js:183:16)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
code: 'ShardingReadyTimeout'
}
Error [ShardingReadyTimeout]: Shard 0's Client took too long to become ready.
at Timeout.onTimeout (C:\Coding\BOTNAMEHERE\bot\node_modules\discord.js\src\sharding\Shard.js:183:16)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
code: 'ShardingReadyTimeout'
}
My current codebase that is related to sharding is two files, an index.js and a bot.js. Index.js: https://pastebin.com/zsik23wV Bot.js: https://pastebin.com/BttCCnpN Now, if there is anything else I can provide please let me know. @Qjuh, this is the post. Just pinging you because you told me to make it.
Pastebin
const Discord = require('discord.js');const fs = require('fs');cons...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
const Discord = require('discord.js');const fs = require('fs');cons...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
21 Replies
d.js toolkit
d.js toolkit4mo ago
- 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
Booboo v(=∩_∩=)フ
Already included all of these.
jamie
jamie4mo ago
manager.spawn({ amount: 'auto', delay: 15500, timeout: 60000 }).catch(e => console.log(e))
manager.spawn({ amount: 'auto', delay: 15500, timeout: 60000 }).catch(e => console.log(e))
this part, amount should be totalShards afaik not sure if its the sole issue but just skimming through real quick :thumb: also, youre using a lot of intents, do you need every single one?
Booboo v(=∩_∩=)フ
For the intents, yes I will be needed all of them. Also what do you mean by it should be totalShards?
jamie
jamie4mo ago
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
d.js docs
d.js docs4mo ago
:class: ShardingManager @14.15.3 This is a utility class that makes multi-process sharding of a bot an easy and painless experience. It works by spawning a self-contained ChildProcess or Worker for each individual shard, each containing its own instance of your bot's Client. They all have a line of communication with the master process, and there are several useful methods that utilise it in order to simplify tasks that are normally difficult with sharding. It can spawn a specific number of shards or the amount that Discord suggests for the bot, and takes a path to your main bot script to launch for each one.
jamie
jamie4mo ago
ah, that wasn't what i meant to do, my bad for the duplicate
Booboo v(=∩_∩=)フ
I am confused, I know what it is but what should I be doing.
jamie
jamie4mo ago
sorry, my bad, i totally misunderstood/got myself lost :DyanSigh: this is redundant:
const manager = new Discord.ShardingManager('./src/bot.js', {
totalShards: 1, //total shards declared here
token: process.env.DISCORD_BOT_TOKEN,
respawn: true,
timeout: -1,
})
const manager = new Discord.ShardingManager('./src/bot.js', {
totalShards: 1, //total shards declared here
token: process.env.DISCORD_BOT_TOKEN,
respawn: true,
timeout: -1,
})
// total shards ALSO declared here through amount
manager.spawn({ amount: 'auto', delay: 15500, timeout: 60000 }).catch(e => console.log(e))
// total shards ALSO declared here through amount
manager.spawn({ amount: 'auto', delay: 15500, timeout: 60000 }).catch(e => console.log(e))
also, are there any other errors before/after the timeout? there's a lot going on before any of your shards are even able to spawn, it may be that
Booboo v(=∩_∩=)フ
I will be able to try them in a few, but there are no other errors. I will let you know how it goes. I removed the
manager.spawn({ amount: 'auto', delay: 15500, timeout: 60000 }).catch(e => console.log(e))
manager.spawn({ amount: 'auto', delay: 15500, timeout: 60000 }).catch(e => console.log(e))
It does not work.
jamie
jamie4mo ago
because you don’t remove the manager spawn; you still need that in order to spawn the shards. the redundant part is the “amount”
Booboo v(=∩_∩=)フ
I am sorry for my incompetence, but this still is not working when this is my code.
const manager = new Discord.ShardingManager('./src/bot.js', {
totalShards: 'auto',
token: process.env.DISCORD_BOT_TOKEN,
respawn: true,
timeout: 60000,
})


manager.spawn({ timeout: 60000 }).catch(e => console.log(e))
const manager = new Discord.ShardingManager('./src/bot.js', {
totalShards: 'auto',
token: process.env.DISCORD_BOT_TOKEN,
respawn: true,
timeout: 60000,
})


manager.spawn({ timeout: 60000 }).catch(e => console.log(e))
What do you think it is?
jamie
jamie4mo ago
. if it doesn't log in on time, it won't continue. does the ready event fire? edited to add: you're using a lot of intents, which is a lot of info - you can try increasing the timeout or figure out why its taking so long to start up
Booboo v(=∩_∩=)フ
The ready event does not fire, I will try incressing the timeout time to 5 minutes. But before that I will remove a lot of the intents. I did, I made it 8 minutes.
Booboo v(=∩_∩=)フ
I changed it, but it still did not work. I do log in.
d.js docs
d.js docs4mo ago
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
Booboo v(=∩_∩=)フ
I am stupid.
Want results from more Discord servers?
Add your server