Negative timeout in @discordjs/ws

Not sure if this is a possible bug in ws package, i left my development bot running overnight on my pc and saw this warning in my console the next day, so i have no idea if its reproducible, a harmless warning, or anything else. It could be caused by my pc going into sleep mode or losing internet perhaps, but it still seems like an undesirable bug to have a negative 6 hour timeout.
(node:5556) TimeoutNegativeWarning: -22236190.632072948 is a negative number.
Timeout duration was set to 1.
at new Timeout (node:internal/timers:195:17)
at setTimeout (node:timers/promises:80:19)
at SimpleIdentifyThrottler.waitForIdentify (\node_modules\@discordjs\ws\src\throttling\SimpleIdentifyThrottler.ts:42:11)
at async WorkerShardingStrategy.onMessage (\node_modules\@discordjs\ws\src\strategies\sharding\WorkerShardingStrategy.ts:324:6)
at async Worker.<anonymous> (\node_modules\@discordjs\ws\src\strategies\sharding\WorkerShardingStrategy.ts:234:6)
(node:5556) TimeoutNegativeWarning: -22236190.632072948 is a negative number.
Timeout duration was set to 1.
at new Timeout (node:internal/timers:195:17)
at setTimeout (node:timers/promises:80:19)
at SimpleIdentifyThrottler.waitForIdentify (\node_modules\@discordjs\ws\src\throttling\SimpleIdentifyThrottler.ts:42:11)
at async WorkerShardingStrategy.onMessage (\node_modules\@discordjs\ws\src\strategies\sharding\WorkerShardingStrategy.ts:324:6)
at async Worker.<anonymous> (\node_modules\@discordjs\ws\src\strategies\sharding\WorkerShardingStrategy.ts:234:6)
Environment Info:
@discordjs/ws: v2.0.3
node: v24.8.0
@discordjs/ws: v2.0.3
node: v24.8.0
Code:
this.ws = new WebSocketManager({
rest: this.rest,
token: token,
intents: new BitField(intents).bitfield,
buildStrategy: manager => new WorkerShardingStrategy(manager, { shardsPerWorker: 4 }),
initialPresence: {
since: Date.now() - process.uptime() * 1000,
activities: [initialPresence.activity],
status: initialPresence.status,
afk: false
},
compression: CompressionMethod.ZlibNative
});
this.ws = new WebSocketManager({
rest: this.rest,
token: token,
intents: new BitField(intents).bitfield,
buildStrategy: manager => new WorkerShardingStrategy(manager, { shardsPerWorker: 4 }),
initialPresence: {
since: Date.now() - process.uptime() * 1000,
activities: [initialPresence.activity],
status: initialPresence.status,
afk: false
},
compression: CompressionMethod.ZlibNative
});
3 Replies
d.js toolkit
d.js toolkit2w ago
aris
aris2w ago
DD
DD2w ago
it was, but check the milestone associated with the PR its unreleased ^ @Magnaboy as described in the PR, this isn't an issue, you can safely ignore the warning node treats the negative value as 1ms, so it's pretty insignificant (in our use case we're trying to not sleep in that case) actual patch will be out next release, already is on dev releases jira just pushed a release that cleanly backported a few commits so https://discord.com/channels/222078108977594368/1006713300177920121/1437433675657646140 should be fixed now on 2.x as well

Did you find this page helpful?