"Cannot perform IP discovery - socket closed"

getting this error after leaving the bot on for some time
file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:286
this.socket.once("close", () => reject(new Error("Cannot perform IP discovery - socket closed")));
^

Error: Cannot perform IP discovery - socket closed
at Socket.<anonymous> (file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:286:46)
at Object.onceWrapper (node:events:627:28)
at Socket.emit (node:events:525:35)
at socketCloseNT (node:dgram:754:8)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
Emitted 'error' event on VoiceConnection instance at:
at VoiceConnection.onNetworkingError (file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:1403:10)
at Networking.emit (node:events:513:28)
at file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:555:32
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:286
this.socket.once("close", () => reject(new Error("Cannot perform IP discovery - socket closed")));
^

Error: Cannot perform IP discovery - socket closed
at Socket.<anonymous> (file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:286:46)
at Object.onceWrapper (node:events:627:28)
at Socket.emit (node:events:525:35)
at socketCloseNT (node:dgram:754:8)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
Emitted 'error' event on VoiceConnection instance at:
at VoiceConnection.onNetworkingError (file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:1403:10)
at Networking.emit (node:events:513:28)
at file:///D:/musicbot/node_modules/@discordjs/voice/dist/index.mjs:555:32
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
is this piece of code below related to the error? (it's a fix for the "Music Bot stops playing after about 30-40 seconds" problem from another thread, although i changed from using Reflect.get to directly accessing properties)
voiceConnection.on('stateChange', (oldState, newState) => {
const oldNetworking = oldState.networking
const newNetworking = newState.networking

const networkStateChangeHandler = (
oldNetworkState,
newNetworkState
) => {
const newUdp = newNetworkState.udp
clearInterval(newUdp?.keepAliveInterval)
}

oldNetworking?.off('stateChange', networkStateChangeHandler)
newNetworking?.on('stateChange', networkStateChangeHandler)
})
voiceConnection.on('stateChange', (oldState, newState) => {
const oldNetworking = oldState.networking
const newNetworking = newState.networking

const networkStateChangeHandler = (
oldNetworkState,
newNetworkState
) => {
const newUdp = newNetworkState.udp
clearInterval(newUdp?.keepAliveInterval)
}

oldNetworking?.off('stateChange', networkStateChangeHandler)
newNetworking?.on('stateChange', networkStateChangeHandler)
})
currently using discord.js 14.7.1, @discordjs/voice 0.14.0, node 19.0.1
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Nutchapol
NutchapolOP2y ago
updated all, will have to watch if it still errors later or not thanks

Did you find this page helpful?