node-ytdl-core: Error: Status code: 416

I have latest ytdl-core

`events.js:287 throw er; // Unhandled ‘error’ event ^

Error: Status code: 416 at ClientRequest.<anonymous> (E:\KrzysBot\node_modules\discord-ytdl-core\node_modules\miniget\dist\index.js:157:27) at Object.onceWrapper (events.js:417:26) at ClientRequest.emit (events.js:310:20) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27) at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17) at TLSSocket.socketOnData (_http_client.js:469:22) at TLSSocket.emit (events.js:310:20) at addChunk (_stream_readable.js:286:12) at readableAddChunk (_stream_readable.js:268:9) at TLSSocket.Readable.push (_stream_readable.js:209:10) Emitted ‘error’ event on PassThrough instance at: at PassThrough.<anonymous> (E:\KrzysBot\node_modules\discord-ytdl-core\node_modules\ytdl-core\lib\index.js:137:14) at PassThrough.emit (events.js:310:20) at ClientRequest.<anonymous> (E:\KrzysBot\node_modules\discord-ytdl-core\node_modules\miniget\dist\index.js:162:28) at Object.onceWrapper (events.js:417:26) [… lines matching original stack trace …] at addChunk (_stream_readable.js:286:12) [nodemon] app crashed - waiting for file changes before starting…`

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 29 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I fixed this problem by using:

ytdl(url, { highWaterMark: 1 << 25 })

I hope this helps.

@fent @Frontesque @wawahuy for any one who has this problem and still getting 416 error: I simply fixed the issue by adding dlChunkSize parameter in ytdl() function and it works as a charm now! this is a sample example of it: ytdl("https://www.youtube.com/watch?v=l-yVYsbvJas" , {filter : "audioonly" , quality: "highestaudio" , dlChunkSize : 1024 * 1024 }).pipe(fs.createWriteStream('music.mp3')) the default dlChunkSize has been set to 10mb (1024 * 1024 * 10). you could try different values and see what works best for you. I don’t exactly know why its a solution but it works for me! hope it helps 😃

I fixed this problem by using:

ytdl(url, { highWaterMark: 1 << 25 })

I hope this helps.

its not really a (good)fix as it makes resources(dl, ram, cpu) go brrrrr edit: however for this issue, i will be trying to find the cause soon