Skip to content
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

Bot crashes when the GuildQueue.delete() method is called while a song from that queue is being loaded #1909

Closed
Duda02 opened this issue May 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Duda02
Copy link

Duda02 commented May 21, 2024

What I have is a simple leave command that calls the GuildQueue.delete() method when executed, combined with leaveOnStop: true from GuildNodeCreateOptions, it makes the bot leave the voice channel. However when the leave command is executed while a song from the queue is being loaded, a Cannot read properties of null (reading 'createStream') error is thrown.

I need some guidance if this can somehow be fixed on my side or requires an update to this package, thanks in advance!

To Reproduce

  1. Add two songs to the queue and start the playback
  2. When the first song finishes playing, call the GuildQueue.delete() method. The time window that this method can be called and will result in a crash is dependent on the song loading time, in my case it seems to be around 2 seconds.
  3. The bot will leave the channel but it will also crash

Expected behavior
The bot is disconnected from the voice channel, but it doesn't crash the application.

Screenshots
image

Please complete the following information:

  • Node Version: 20.12.1
  • Discord Player Version: 6.6.8
  • Discord.js Version: 14.15.2
@Duda02 Duda02 added the bug Something isn't working label May 21, 2024
@Duda02
Copy link
Author

Duda02 commented May 21, 2024

I've managed to find a workaround that catches the uncaught exception and prevents the crash.

process.on('uncaughtException', (error) => {
    console.error(error);
});

@twlite twlite closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants