Sharding is required

I have setup sharding but i still get sharding is required and bot wont start.
// Define Packages
const { Client, GatewayIntentBits } = require('discord.js');
const config = require('./config.json');
const {ClusterClient, getInfo} = require('discord-hybrid-sharding');
const info = getInfo()

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.cluster = new ClusterClient(client);
client.login(config.discord.token);
// Define Packages
const { Client, GatewayIntentBits } = require('discord.js');
const config = require('./config.json');
const {ClusterClient, getInfo} = require('discord-hybrid-sharding');
const info = getInfo()

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.cluster = new ClusterClient(client);
client.login(config.discord.token);
const { ClusterManager } = require('discord-hybrid-sharding')
const BOT_TOKEN = ''
const manager = new ClusterManager(`./bot.js`, {
totalShards: 1,
totalClusters: 1,
mode: 'process',
token: BOT_TOKEN,
})
manager.on('clusterCreate', cluster => console.log(`Launched cluster ${cluster.id}`))
manager.spawn({amount: 1, delay: 10000})
const { ClusterManager } = require('discord-hybrid-sharding')
const BOT_TOKEN = ''
const manager = new ClusterManager(`./bot.js`, {
totalShards: 1,
totalClusters: 1,
mode: 'process',
token: BOT_TOKEN,
})
manager.on('clusterCreate', cluster => console.log(`Launched cluster ${cluster.id}`))
manager.spawn({amount: 1, delay: 10000})
7 Replies
d.js toolkit
d.js toolkit11mo 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!
jaymart
jaymart11mo ago
Node.js v18.16.1
C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057
throw new Error("Sharding is required");
^

Error: Sharding is required
at WebSocketShard.onClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057:15)
at WebSocket.emit (node:events:513:28)
at WebSocket.emitClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:258:10)
at TLSSocket.socketOnClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:1264:15)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7)

Node.js v18.16.1
C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:151
reject(new Error('CLUSTERING_READY_DIED | ClusterId: ' + this.id));
^

Error: CLUSTERING_READY_DIED | ClusterId: 0
at Cluster.onDeath (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:151:24)
at Object.onceWrapper (node:events:628:26)
at Cluster.emit (node:events:513:28)
at Cluster._handleExit (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:280:14)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Emitted 'error' event on Cluster instance at:
at C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:289:44
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.16.1
Node.js v18.16.1
C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057
throw new Error("Sharding is required");
^

Error: Sharding is required
at WebSocketShard.onClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057:15)
at WebSocket.emit (node:events:513:28)
at WebSocket.emitClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:258:10)
at TLSSocket.socketOnClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:1264:15)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7)

Node.js v18.16.1
C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:151
reject(new Error('CLUSTERING_READY_DIED | ClusterId: ' + this.id));
^

Error: CLUSTERING_READY_DIED | ClusterId: 0
at Cluster.onDeath (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:151:24)
at Object.onceWrapper (node:events:628:26)
at Cluster.emit (node:events:513:28)
at Cluster._handleExit (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:280:14)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Emitted 'error' event on Cluster instance at:
at C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord-hybrid-sharding\dist\Core\Cluster.js:289:44
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.16.1
just realized i have hybrid sharding here but i swapped to djs shardingmangaer and same exact error
C:\Users\jmart\Documents\GitHub\Dash>node index.js
Launched cluster 0
C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057
throw new Error("Sharding is required");
^

Error: Sharding is required
at WebSocketShard.onClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057:15)
at WebSocket.emit (node:events:513:28)
at WebSocket.emitClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:258:10)
at TLSSocket.socketOnClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:1264:15)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7)

Node.js v18.16.1
C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord.js\src\sharding\Shard.js:171
reject(new DiscordjsError(ErrorCodes.ShardingReadyDied, this.id));
^

Error [ShardingReadyDied]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord.js\src\sharding\Shard.js:171:16)
at Object.onceWrapper (node:events:628:26)
at Shard.emit (node:events:513:28)
at Shard._handleExit (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord.js\src\sharding\Shard.js:421:10)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: 'ShardingReadyDied'
}

Node.js v18.16.1
C:\Users\jmart\Documents\GitHub\Dash>node index.js
Launched cluster 0
C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057
throw new Error("Sharding is required");
^

Error: Sharding is required
at WebSocketShard.onClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\@discordjs\ws\dist\index.js:1057:15)
at WebSocket.emit (node:events:513:28)
at WebSocket.emitClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:258:10)
at TLSSocket.socketOnClose (C:\Users\jmart\Documents\GitHub\Dash\node_modules\ws\lib\websocket.js:1264:15)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7)

Node.js v18.16.1
C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord.js\src\sharding\Shard.js:171
reject(new DiscordjsError(ErrorCodes.ShardingReadyDied, this.id));
^

Error [ShardingReadyDied]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord.js\src\sharding\Shard.js:171:16)
at Object.onceWrapper (node:events:628:26)
at Shard.emit (node:events:513:28)
at Shard._handleExit (C:\Users\jmart\Documents\GitHub\Dash\node_modules\discord.js\src\sharding\Shard.js:421:10)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: 'ShardingReadyDied'
}

Node.js v18.16.1
j
j11mo ago
discord-hybrid-sharding doesnt seem to be related to djs oh they arent even in the server
Harnes
Harnes11mo ago
Can u show a code? Also if u use third-party packages then this isn't djs related
j
j11mo ago
they arent in the server
Harnes
Harnes11mo ago
... yeah mb
j
j11mo ago
pepethumbsup