Client won't start

I added client.on('debug', console.log), and this is what I get:
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 12
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 979
[WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 0] Waiting for event hello for 60000ms
[WS => Shard 1] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 1] Waiting for event hello for 60000ms
[WS => Shard 2] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 2] Waiting for event hello for 60000ms
[WS => Shard 3] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 3] Waiting for event hello for 60000ms
[WS => Shard 4] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 4] Waiting for event hello for 60000ms
[WS => Shard 2] Preparing first heartbeat of the connection with a jitter of 0.7972825342558598; waiting 32887ms
[WS => Shard 2] Waiting for identify throttle
[WS => Shard 2] Identifying
shard id: 2
shard count: 5
intents: 33539
compression: none
[WS => Shard 2] Waiting for event ready for 15000ms
[WS => Shard 0] Preparing first heartbeat of the connection with a jitter of 0.12541573167101427; waiting 5173ms
[WS => Shard 0] Waiting for identify throttle
[WS => Shard 1] Preparing first heartbeat of the connection with a jitter of 0.8107862883645616; waiting 33444ms
[WS => Shard 1] Waiting for identify throttle
[WS => Shard 4] Preparing first heartbeat of the connection with a jitter of 0.8720030372092631; waiting 35970ms
[WS => Shard 4] Waiting for identify throttle
[WS => Shard 3] Preparing first heartbeat of the connection with a jitter of 0.9811653995885212; waiting 40473ms
[WS => Shard 3] Waiting for identify throttle
[WS => Shard 0] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 0] Heartbeat acknowledged, latency of 203ms.
[WS => Shard 0] Identifying
shard id: 0
shard count: 5
intents: 33539
compression: none
[WS => Shard 0] Waiting for event ready for 15000ms
[WS => Shard 1] Identifying
shard id: 1
shard count: 5
intents: 33539
compression: none
[WS => Shard 1] Waiting for event ready for 15000ms
[WS => Shard 4] Identifying
shard id: 4
shard count: 5
intents: 33539
compression: none
[WS => Shard 4] Waiting for event ready for 15000ms
[WS => Shard 3] Identifying
shard id: 3
shard count: 5
intents: 33539
compression: none
[WS => Shard 3] Waiting for event ready for 15000ms
[WS => Shard 2] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 2251
[WS => Shard 2] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 1] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 4] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 3] First heartbeat sent, starting to beat every 41250ms
[ERROR] Task failed | Skipped execution of task `patreon` because it requires the client instance which is not ready (yet).
[WS => Shard 3] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 2348
[WS => Shard 2] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 2] Connection status during destroy
Needs closing: true
Ready state: 1
[WS => Shard 1] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 1] Connection status during destroy
Needs closing: true
Ready state: 1
[WS => Shard 4] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 4] Connection status during destroy
Needs closing: true
Ready state: 1
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 12
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 979
[WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 0] Waiting for event hello for 60000ms
[WS => Shard 1] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 1] Waiting for event hello for 60000ms
[WS => Shard 2] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 2] Waiting for event hello for 60000ms
[WS => Shard 3] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 3] Waiting for event hello for 60000ms
[WS => Shard 4] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 4] Waiting for event hello for 60000ms
[WS => Shard 2] Preparing first heartbeat of the connection with a jitter of 0.7972825342558598; waiting 32887ms
[WS => Shard 2] Waiting for identify throttle
[WS => Shard 2] Identifying
shard id: 2
shard count: 5
intents: 33539
compression: none
[WS => Shard 2] Waiting for event ready for 15000ms
[WS => Shard 0] Preparing first heartbeat of the connection with a jitter of 0.12541573167101427; waiting 5173ms
[WS => Shard 0] Waiting for identify throttle
[WS => Shard 1] Preparing first heartbeat of the connection with a jitter of 0.8107862883645616; waiting 33444ms
[WS => Shard 1] Waiting for identify throttle
[WS => Shard 4] Preparing first heartbeat of the connection with a jitter of 0.8720030372092631; waiting 35970ms
[WS => Shard 4] Waiting for identify throttle
[WS => Shard 3] Preparing first heartbeat of the connection with a jitter of 0.9811653995885212; waiting 40473ms
[WS => Shard 3] Waiting for identify throttle
[WS => Shard 0] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 0] Heartbeat acknowledged, latency of 203ms.
[WS => Shard 0] Identifying
shard id: 0
shard count: 5
intents: 33539
compression: none
[WS => Shard 0] Waiting for event ready for 15000ms
[WS => Shard 1] Identifying
shard id: 1
shard count: 5
intents: 33539
compression: none
[WS => Shard 1] Waiting for event ready for 15000ms
[WS => Shard 4] Identifying
shard id: 4
shard count: 5
intents: 33539
compression: none
[WS => Shard 4] Waiting for event ready for 15000ms
[WS => Shard 3] Identifying
shard id: 3
shard count: 5
intents: 33539
compression: none
[WS => Shard 3] Waiting for event ready for 15000ms
[WS => Shard 2] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 2251
[WS => Shard 2] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 1] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 4] First heartbeat sent, starting to beat every 41250ms
[WS => Shard 3] First heartbeat sent, starting to beat every 41250ms
[ERROR] Task failed | Skipped execution of task `patreon` because it requires the client instance which is not ready (yet).
[WS => Shard 3] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 2348
[WS => Shard 2] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 2] Connection status during destroy
Needs closing: true
Ready state: 1
[WS => Shard 1] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 1] Connection status during destroy
Needs closing: true
Ready state: 1
[WS => Shard 4] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 4] Connection status during destroy
Needs closing: true
Ready state: 1
10 Replies
d.js toolkit
d.js toolkitā€¢3mo 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
and
andOPā€¢3mo ago
Shard did not receive any guild packets in 15000 ms. I think that's what causes the issue but I'm not sure I'm also listening to client.rest.on('rateLimited'), but nothing it suddenly stopped working and now none of my 12k guilds can use it šŸ˜­ tried it both on VPS and on my windows pc, same issue lmk if I can provide any code / whatever to fix this oh okayyy what does zombie shard mean? but what could be the issue? I have no idea of how websockets even work roughly 12k I read that one shard can be 2.5k max so I have shardCount: 5 rn yea I tried to put the recommended 12 shards, but same problem
and
andOPā€¢3mo ago
https://i.anderle.dev/08xQBhjgS2.png that doesn't seem to work either
and
andOPā€¢3mo ago
OHH let me try one sec same issue, some shards say Heartbeat acknowledged, latency of 1461ms. or smth but like half of them same issue it's a well known vps host which should definitely have a good network connection like one of my friends has a bot in more than 100k guilds and it works fine no I don't use that when creating the client I added makeCache and sweepers could that be an issue? basically I set everything to 0 that I don't need because I experienced high ram usage
makeCache: Options.cacheWithLimits({
...Options.DefaultMakeCacheSettings,
GuildMemberManager: {
maxSize: 0,
keepOverLimit: member => member.guild.id === servers.kuudra_gang || member.id === member.client.user.id
},
GuildEmojiManager: 0,
MessageManager: 0,
DMMessageManager: 0,
PresenceManager: 0,
BaseGuildEmojiManager: 0,
GuildMessageManager: 0,
GuildInviteManager: 0,
ReactionManager: 0,
ThreadManager: 0,
ThreadMemberManager: 0,
ReactionUserManager: 0,
GuildBanManager: 0,
GuildForumThreadManager: 0,
GuildScheduledEventManager: 0,
GuildStickerManager: 0,
GuildTextThreadManager: 0,
StageInstanceManager: 0,
ApplicationCommandManager: 0,
AutoModerationRuleManager: 0,
VoiceStateManager: 0
}),
makeCache: Options.cacheWithLimits({
...Options.DefaultMakeCacheSettings,
GuildMemberManager: {
maxSize: 0,
keepOverLimit: member => member.guild.id === servers.kuudra_gang || member.id === member.client.user.id
},
GuildEmojiManager: 0,
MessageManager: 0,
DMMessageManager: 0,
PresenceManager: 0,
BaseGuildEmojiManager: 0,
GuildMessageManager: 0,
GuildInviteManager: 0,
ReactionManager: 0,
ThreadManager: 0,
ThreadMemberManager: 0,
ReactionUserManager: 0,
GuildBanManager: 0,
GuildForumThreadManager: 0,
GuildScheduledEventManager: 0,
GuildStickerManager: 0,
GuildTextThreadManager: 0,
StageInstanceManager: 0,
ApplicationCommandManager: 0,
AutoModerationRuleManager: 0,
VoiceStateManager: 0
}),
one of my friends said that it could be rate limit, even if I don't get any log message? alright yess nothing raw doesn't exist or am I dumb ohh I'll just change it in the dist then aight ReferenceError: data is not defined oh wait I see data => now I don't even get a ts error a lot of GUILD_CREATE should i copy smth or
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 1] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 1] Waiting for event hello for 60000ms
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 7] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 942
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 1] Preparing first heartbeat of the connection with a jitter of 0.1727355573856908; waiting 7125ms
[WS => Shard 1] Waiting for identify throttle
[WS => Shard 1] Identifying
shard id: 1
shard count: 12
intents: 33539
compression: none
[WS => Shard 1] Waiting for event ready for 15000ms
GUILD_CREATE
[WS => Shard 9] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 9] Connection status during destroy
Needs closing: true
Ready state: 1
[WS => Shard 2] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 2] Connection status during destroy
Needs closing: true
Ready state: 1
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
PRESENCE_UPDATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
READY
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
PRESENCE_UPDATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 3] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 3] Connection status during destroy
Needs closing: true
Ready state: 1
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 11] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 835
[WS => Shard 1] First heartbeat sent, starting to beat every 41250ms
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 1] Connecting to wss://gateway.discord.gg?v=10&encoding=json
[WS => Shard 1] Waiting for event hello for 60000ms
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 7] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 942
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 1] Preparing first heartbeat of the connection with a jitter of 0.1727355573856908; waiting 7125ms
[WS => Shard 1] Waiting for identify throttle
[WS => Shard 1] Identifying
shard id: 1
shard count: 12
intents: 33539
compression: none
[WS => Shard 1] Waiting for event ready for 15000ms
GUILD_CREATE
[WS => Shard 9] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 9] Connection status during destroy
Needs closing: true
Ready state: 1
[WS => Shard 2] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 2] Connection status during destroy
Needs closing: true
Ready state: 1
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
PRESENCE_UPDATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
READY
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
PRESENCE_UPDATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 3] Destroying shard
Reason: Zombie connection
Code: 4200
Recover: Resume
[WS => Shard 3] Connection status during destroy
Needs closing: true
Ready state: 1
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
[WS => Shard 11] Shard did not receive any guild packets in 15000 ms.
Unavailable guild count: 835
[WS => Shard 1] First heartbeat sent, starting to beat every 41250ms
GUILD_CREATE
GUILD_CREATE
that's like a part it did spam a lot still not able to fix ye, I'll disable them all and check again it worked again for some reason btw but not anymore :kek: yeah I already did, thank you a friend is helping too, and he's asking why does discord.js send identify before first heartbeat I started without anything, only the client but same thing like create the client object, add the listeners and then call client.login it doesn't work on my windows machine with 50mbps and not on my vps with 500 mbps do you think switching to using a ShardingManager will fix this? because the discordjs guide says internal sharding is not good for bigger bots okay man btw thank you so much for helping me with this oh btw for the network traffic my vps shows it's using only 10 mpbs
d.js docs
d.js docsā€¢3mo ago
:propertysignature: ClientOptions#ws @14.16.1 Options for the WebSocket
and
andOPā€¢3mo ago
buildStrategy? or wdym uhh alright? I'm not sure if I understand
/**
* Strategies responsible for spawning, initializing connections, destroying shards, and relaying events
*/
interface IShardingStrategy {
/**
* Initializes all the shards
*/
connect(): Awaitable<void>;
/**
* Destroys all the shards
*/
destroy(options?: Omit<WebSocketShardDestroyOptions, 'recover'>): Awaitable<void>;
/**
* Fetches the status of all the shards
*/
fetchStatus(): Awaitable<Collection<number, WebSocketShardStatus>>;
/**
* Sends a payload to a shard
*/
send(shardId: number, payload: GatewaySendPayload): Awaitable<void>;
/**
* Spawns all the shards
*/
spawn(shardIds: number[]): Awaitable<void>;
}
/**
* Strategies responsible for spawning, initializing connections, destroying shards, and relaying events
*/
interface IShardingStrategy {
/**
* Initializes all the shards
*/
connect(): Awaitable<void>;
/**
* Destroys all the shards
*/
destroy(options?: Omit<WebSocketShardDestroyOptions, 'recover'>): Awaitable<void>;
/**
* Fetches the status of all the shards
*/
fetchStatus(): Awaitable<Collection<number, WebSocketShardStatus>>;
/**
* Sends a payload to a shard
*/
send(shardId: number, payload: GatewaySendPayload): Awaitable<void>;
/**
* Spawns all the shards
*/
spawn(shardIds: number[]): Awaitable<void>;
}
this? I'm lost what do I do with that ok sorry I don't think I understood what you mean with "using worker strategy" couldn't find that example, but thank you yeah no worries lmao just wasn't sure what you meant nah that didn't change anything I'll make sure and try on my vps too yeah same thing I restarted the vps and noticed something new it worked for 4/5 shards this time like I look at the messages "shard received all guilds" I got this message from 4/5 shards and the last shard was missing 1.7k guilds but I got the clientReady event this time but that would mean, in 1.7k guilds the bot won't work, right? nvm the last shard got ready before the client was ready I'm wondering why it works completely fine and fast for those 4 shards, and then suddenly stops working and returns to being super slow then this time again it stopped at the first shard already, after like 200 guilds and this time it worked, all shards started in not even 20s so it's always different every time and I refuse to understand why šŸ˜­ yeah it's called "shared vCPU" oh wait that could mean someone else is blocking the network or smth? but like why wouldn't it work on my own pc then no, only clientReady no I didn't, I can do that I'll just keep on debug then oh yea okay same error only listened to the debug event oh yeah I'm using the newest discordjs version on my windows pc and 14.13.0 on my vps uh I was lazy to update I think I updated a week ago and wanted to push this to the vps soon but then this issue came up so yep now they're on different versions yesss šŸ˜­ my node version is 20.17.0 in case you need it yeah, even in the same region the vps is like 20km away from me I mean my discord is working fine or is that smth else I mean my desktop client can you like.. connect to a different one? oh also this
[WS => Shard 3] Resuming session
resume url: wss://gateway-us-east1-d.discord.gg
sequence: 576
shard id: 3
[WS => Shard 3] Resuming session
resume url: wss://gateway-us-east1-d.discord.gg
sequence: 576
shard id: 3
shouldn't it connect to somewhere in EU if my vps is there (idk what resuming session means just wondering about the url) can you check this somehow? I mean can I it's been happening for let's say 2 weeks, whenever I tried to restart the vps I got it fixed but today a restart didn't fix it can it even be that a relay is down for such a long time? but it's weird that it connects to us east right? yeah I don't think it's that tbh seems to be related to intents and / or makeCache settings I started the bot without anything (just shardCount and empty intents) and it worked now I tried guilds and guildmembers intents and it worked too I'll slowly add more, and see where it stops working I THINK TOO YES YESYESS it's GuildPresences it works with all other intents except this and the good thing is I removed the single feature I needed this for ages ago that explains why it sometimes starts being slow at the very start, and sometimes everything goes well for 4/5 shards? I mean like sometimes that one guild could be in shard 4 and sometimes in shard 0 or is that the same always? oh I see oh interesting
d.js docs
d.js docsā€¢3mo ago
:method: (static) ShardClientUtil#shardIdForGuildId() @14.16.1 Get the shard id for a given guild id.
and
andOPā€¢3mo ago
man, thank you so so much for spending so much time on this I really appreciate what you did for me will take a look! this was such a hard one really, thank you I'm just so happy rn
d.js docs
d.js docsā€¢3mo ago
:function: calculateShardId @1.1.1 Calculates the shard id for a given guild id.
and
andOPā€¢3mo ago
thank you lmao and for being so patient I'll mark this as solved
Want results from more Discord servers?
Add your server