-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip throws Error [ERR_STREAM_PREMATURE_CLOSE] #1570
Comments
You can ignore this error, it is caused by the usage of |
when I use the command the music stops and after a few seconds the bot disconnects. |
I'm getting this error too using the latest version from npm:
The solution is to ignore uncaught exceptions but then pm2 can't restart the process when something else breaks. Can I ask when will the fix be included in npm? |
This fix is already included in discord-player part (handled on dsp filters pipeline). You might be getting this error elsewhere because if it was from discord-player, the error event would have caught it. Edit: as per your stacktrace, it seems to be coming from |
My trace is similar to the one in the first comment. Only difference I can see is the PCMResampler class, which is replaced with Encoder in my trace. The exception occurs when I queue.delete() or player.destroy() while playing a youtube video. Do you think my problem is unrelated to this bug? |
The original error of this issue came from
It could be due to a fault in npm install causing some dependencies to break, you can try removing |
Unfortunately the problem persists after removing node_modules and cleaning the cache. I've found Encoder in prism-media: function loadOpus(refresh = false) {
if (Opus.Encoder && !refresh) return Opus;
Opus = loader.require([
['@discordjs/opus', opus => ({ Encoder: opus.OpusEncoder })],
['node-opus', opus => ({ Encoder: opus.OpusEncoder })],
['opusscript', opus => ({ Encoder: opus })],
]);
return Opus;
} |
I added console logging to this file and can confirm the exception comes from some other place. |
Well, I gave up and just added filtering to the uncaught exception handler. Not pretty but works. process.on("uncaughtException", function (err) {
if (!err.stack?.includes("ERR_STREAM_PREMATURE_CLOSE")) {
console.error(err.stack);
exitHandler.bind(null, { exit: true, signal: "uncaughtException" });
}
}); |
It happens when i use skip and stop, throws the exception, but the queue doesnt ends, rather it restarts but in another order.
The error picks them up from the event Player.on("error").
Full exception:
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:387:5)
at PCMResampler.onclose (node:internal/streams/end-of-stream:140:30)
at PCMResampler.emit (node:events:525:35)
at emitCloseNT (node:internal/streams/destroy:138:10)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
discord-player: dev
Thanks.
The text was updated successfully, but these errors were encountered: