question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Cannot call write after a stream was destroyed

See original GitHub issue

Describe the bug My bot has commands that allow to turn on sound effects that might be funny, but when running these commands, the console sometimes has an error with some commands and the song won’t open due to this error.

To Reproduce Steps to reproduce the behavior:

  1. Run this.client.player.play(message, "https://youtu.be/pFqS716gUzo"); code
  2. See Cannot call write after a stream was destroyed error

Expected behavior The behavior I expected was for the song to start playing

Please complete the following information:

  • Node Version: 12.5.3
  • Discord.js Version: 12.22.1

Additional context Normally this code was working properly until a few days ago but it no longer works and gives Cannot call write after a stream was destroyed error

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
Vins2106commented, Apr 29, 2021

maybe you can try without install ytdl-core. who knows can 🤷‍♂️

0reactions
eareeecommented, Apr 30, 2021

I’ve gotten this error once, but this fixes it (instal ytdl-core latest version first):

const <player> =  new DiscordPlayer.Player(client, {
      ytdlDownloadOptions: {filter: "audioandvideo"}
    });

if not please forgive me I’ve tried it and it works.

problem was solved thanks to this code thank you very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot call write after a stream was destroyed #4284 - GitHub
This issue happens because you don't have enough disk space left on the server. Run pm2 flush to empty the logs.
Read more >
Error [ERR_STREAM_DESTROYED]: Cannot call write after a ...
It worked locally, but when it got to aws, the error happened because node is running as user 'webapp'. It looks like that...
Read more >
Node.js Stream writable.destroy() Method - GeeksforGeeks
In the above example, an error occurs because the write() method was called after the stream was destroyed. Reference: https://nodejs.org/api/ ...
Read more >
Error [ERR_STREAM_DESTROYED] - Node-RED Forum
I get the following error occasionally which I need to trap and issue something like ... Cannot call write after a stream was...
Read more >
Worker failures from stream write contention - GenieACS Forum
This happens to me on current master builds as well. Smells like a state management bug (trying to write to a socket that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found