AbortError: The operation was aborted

I have a bot, which is playing music. It connects to the channel and also plays the music but sometimes there is the following error and the music stops playing but the bot is still in the channel
AbortError: The operation was aborted
at AbortSignal.abortListener (node:events:958:14)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'ABORT_ERR',
[cause]: DOMException [AbortError]: This operation was aborted
at new DOMException (node:internal/per_context/domexception:72:5)
at AbortController.abort (node:internal/abort_controller:321:18)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
}
AbortError: The operation was aborted
at AbortSignal.abortListener (node:events:958:14)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'ABORT_ERR',
[cause]: DOMException [AbortError]: This operation was aborted
at new DOMException (node:internal/per_context/domexception:72:5)
at AbortController.abort (node:internal/abort_controller:321:18)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
}
10 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
DJipgen
DJipgenOP2y ago
discord.js --> [email protected] node --> v16.17.0
Idris
Idris2y ago
npm ls @discordjs/voice and show the output
DJipgen
DJipgenOP2y ago
└── @discordjs/[email protected]
d.js docs
d.js docs2y ago
To debug your voice connection and player: • Use debug: true when creating your VoiceConnection and AudioPlayer • Add an event listener to the <VoiceConnection> and the <AudioPlayer>:
// Add one for each class if applicable
<AudioPlayer | VoiceConnection>
.on('debug', console.log)
.on('error', console.error)
// Add one for each class if applicable
<AudioPlayer | VoiceConnection>
.on('debug', console.log)
.on('error', console.error)
• Add an error listener to the stream you are passing to the resource:
<Stream>.on('error', console.error)
<Stream>.on('error', console.error)
Note: The <> represents classes that need to be adapted to their respective name in your code
Idris
Idris2y ago
might be related to ytdl-core or something
DJipgen
DJipgenOP2y ago
I don't use ytdl-core, only playing a .ogg stream
Idris
Idris2y ago
ah ok
DJipgen
DJipgenOP2y ago
@qjuh
AbortError: The operation was aborted
at AbortSignal.abortListener (node:events:958:14)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'ABORT_ERR',
[cause]: DOMException [AbortError]: This operation was aborted
at new DOMException (node:internal/per_context/domexception:72:5)
at AbortController.abort (node:internal/abort_controller:321:18)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
}
node:events:491
throw er; // Unhandled 'error' event
^
AbortError: The operation was aborted
at AbortSignal.abortListener (node:events:958:14)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'ABORT_ERR',
[cause]: DOMException [AbortError]: This operation was aborted
at new DOMException (node:internal/per_context/domexception:72:5)
at AbortController.abort (node:internal/abort_controller:321:18)
at Timeout.<anonymous> (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:2504:39)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
}
node:events:491
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on VoiceConnection instance at:
at VoiceConnection.onNetworkingError (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:1898:10)
at Networking.emit (node:events:513:28)
at Networking.onChildError (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:630:10)
at VoiceWebSocket.emit (node:events:513:28)
at WebSocket.VoiceWebSocket.ws.onerror (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:420:37)
at callListener (/home/bots/dcbot/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onError (/home/bots/dcbot/node_modules/ws/lib/event-target.js:230:9)
at WebSocket.emit (node:events:513:28)
at emitErrorAndClose (/home/bots/dcbot/node_modules/ws/lib/websocket.js:1008:13)
at ClientRequest.<anonymous> (/home/bots/dcbot/node_modules/ws/lib/websocket.js:856:5) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on VoiceConnection instance at:
at VoiceConnection.onNetworkingError (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:1898:10)
at Networking.emit (node:events:513:28)
at Networking.onChildError (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:630:10)
at VoiceWebSocket.emit (node:events:513:28)
at WebSocket.VoiceWebSocket.ws.onerror (/home/bots/dcbot/node_modules/@discordjs/voice/dist/index.js:420:37)
at callListener (/home/bots/dcbot/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onError (/home/bots/dcbot/node_modules/ws/lib/event-target.js:230:9)
at WebSocket.emit (node:events:513:28)
at emitErrorAndClose (/home/bots/dcbot/node_modules/ws/lib/websocket.js:1008:13)
at ClientRequest.<anonymous> (/home/bots/dcbot/node_modules/ws/lib/websocket.js:856:5) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
`
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
Hmm, is there a possibility to fetch these -104 ECONNRESET errors? I can't find the trigger of this error... Do you know if this error is coming from AudioPlayer, VoiceConnection or Stream? Hmm okay, I check it out - thank you! I have found the point where the error is generated:
connection.on(VoiceConnectionStatus.Disconnected, async (oldState, newState) => {
try {
await Promise.race([
entersState(connection, VoiceConnectionStatus.Signalling, 5_000),
entersState(connection, VoiceConnectionStatus.Connecting, 5_000),
]);
// Seems to be reconnecting to a new channel - ignore disconnect
} catch (error) {
// Seems to be a real disconnect which SHOULDN'T be recovered from
console.log("HERE IS THE ERROR");
}
});
connection.on(VoiceConnectionStatus.Disconnected, async (oldState, newState) => {
try {
await Promise.race([
entersState(connection, VoiceConnectionStatus.Signalling, 5_000),
entersState(connection, VoiceConnectionStatus.Connecting, 5_000),
]);
// Seems to be reconnecting to a new channel - ignore disconnect
} catch (error) {
// Seems to be a real disconnect which SHOULDN'T be recovered from
console.log("HERE IS THE ERROR");
}
});
What would be the best practise to "recover" the voice connection? Creating a new connection with joinVoiceChannel? But why my bot don't disconnects from the voice channel, only the sound not works... Could it be a network disconnect then?
dzlandis
dzlandis13mo ago
So how is one meant to resolve this issue. I'm experiencing a similar issue but there doesn't seem to be a concrete solution here? Any guidance?
Want results from more Discord servers?
Add your server