Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Discord.js Spawning shard error: Shards are still spawning

I'm currently in the process of trying to register my slash commands across 10 shards for my bot, and in doing so I'm coming accross this error:

node:internal/process/promises:246 triggerUncaughtException(err, true /* fromPromise */); ^

Error [SHARDING_IN_PROCESS]: Shards are still being spawned.

I'm not entirely sure what to do / how to go about fixing this issue.

This is how I'm trying to register my slash commands across each shard, I've tried doing it during a 'ready' event, and also the shardReady event from DJs but still no luck unfortunately.

bot.on('shardReady', async ()=> {
        (await PG(`${process.cwd()}/commands/*/*.js`)).map(async (file)=>{
            const cmds = require(file)
            await bot.shard.broadcastEval((c)=>{
                c.guilds.cache.forEach((guild)=>{
                    guild.commands.set(cmds).catch(()=>{})
                });
            });
        
        
        });

    });

and I'm currently handling my sharding with:

const { ShardingManager } = require('discord.js');
const { token, dblToken } = require('./config.json');
const manager = new ShardingManager('./bot.js', {
  token,
  totalShards: 11,
  respawn: true,
});
//const { AutoPoster } = require('topgg-autoposter')
 //const ap = AutoPoster(dblToken, manager)

manager.on("shardCreate", shard => {
  shard.on('reconnecting', () => {
    console.log(`Reconnecting shard: [${shard.id}]`);
  });
  shard.on('spawn', () => {
    console.log(`Spawned shard: [${shard.id}]`);
  });
  shard.on('ready', () => {
    console.log(` Shard [${shard.id}] is ready`);
  });
  shard.on('death', () => {
    console.log(`Died shard: [${shard.id}]`);
  });
});

 /*ap.on('posted', () => {
  console.log('Posted Stats.')
})*/ 

manager.spawn();

Any help would honestly be appreciated! I've been stuck with this for the last week and a half and my bot has been down since.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!