Repository: yt-dlp/yt-dlp

Issue:
"ERROR: Unable to download video subtitles for 'en': [Errno 2] No such file or directory" with m3u8 webvtt subs
### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2022.07.18** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

I'm having an recurring issue where yt-dlp will fail to download a fragment, but error out because it can't find the downloaded fragment file instead of retrying the download. When it happens, if I re-run the command, yt-dlp retrieves the previously missing fragment and continues with the download normally. This sometimes doesn't happen for a stream. Sometimes several times in one stream. If I download the same stream multiple times, the error will occur for different fragments. It only happens with the vtt stream. The audio and video streams don't exhibit this issue.

For example:
(see https://github.com/yt-dlp/yt-dlp/issues/4521#issuecomment-1772146653)

<details>

ERROR: Unable to download video subtitles for 'en': [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'

When I immediately re-ran the command, Frag244 was downloaded without error and the download completed without issue.

I don't think this is the PlutoTV server returning a 404 or other error because when that's happened it's repeatable (the same fragment always fails) and the error yt-dlp gives in those cases is different. This error is almost like yt-dlp fully believes it downloaded Frag244 and is now surprised it's not there.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '-N', '1', '--check-formats', '--embed-subs', '--keep-fragments', '-o', '%(series)s/Season %(season_number)02d/%(series)s s%(season_number)02de%(episode_number)02d %(title)s.%(ext)s', 'https://pluto.tv/en/on-demand/series/stargate-sg-1-ptv1/season/9/episode/camelot-9-20']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.07.18 [135f05e]
[debug] Python 3.8.13 (CPython 64bit) - FreeBSD-12.3-RELEASE-p5-amd64-64bit-ELF (libc 7)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.05.18.1, mutagen-1.45.1, websockets-10.3
[debug] Proxy map: {}
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.07.18, Current version: 2022.07.18
yt-dlp is up to date (2022.07.18)
[debug] [PlutoTV] Extracting URL: https://pluto.tv/en/on-demand/series/stargate-sg-1-ptv1/season/9/episode/camelot-9-20
[PlutoTV] stargate-sg-1-ptv1: Downloading JSON metadata
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 information
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Downloading subtitles: en
[debug] Default format spec: bestvideo*+bestaudio/best
[info] Testing format hls-2374
[hlsnative] Downloading m3u8 manifest
ERROR: This video is DRM protected; Try selecting another format with --format or add --check-formats to automatically fallback to the next best format
  File "/home/melissa/.local/bin/yt-dlp", line 8, in <module>
    sys.exit(main())
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 940, in main
    _exit(*variadic(_real_main(argv)))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 932, in _real_main
    return ydl.download(all_urls)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3281, in download
    self.__download_wrapper(self.extract_info)(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3257, in wrapper
    res = func(*args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1422, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1431, in wrapper
    return func(self, *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1521, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1578, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2608, in process_video_result
    formats_to_download = list(format_selector({
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2120, in selector_function
    yield from f(ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2219, in final_selector
    return selector_function(ctx_copy)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2131, in selector_function
    picked_formats = list(f(ctx))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2140, in selector_function
    for pair in itertools.product(selector_1(ctx), selector_2(ctx)):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2209, in selector_function
    yield matches[format_idx - 1]
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/utils.py", line 2696, in __getitem__
    self._cache.extend(itertools.islice(self._iterable, n))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2112, in _check_formats
    yield from self._check_formats(formats)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1883, in _check_formats
    success, _ = self.dl(temp_file.name, f, test=True)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2860, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/hls.py", line 82, in real_download
    self.report_error(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 971, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 903, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())


[info] Unable to download format hls-2374. Skipping...
[info] Testing format hls-2387
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 523
[download] Destination: /tmp/tmpx2atrt6i.tmp
[download] 100% of 1.14MiB in 00:00
[info] Testing format hls-2374
[hlsnative] Downloading m3u8 manifest
ERROR: This video is DRM protected; Try selecting another format with --format or add --check-formats to automatically fallback to the next best format
  File "/home/melissa/.local/bin/yt-dlp", line 8, in <module>
    sys.exit(main())
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 940, in main
    _exit(*variadic(_real_main(argv)))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 932, in _real_main
    return ydl.download(all_urls)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3281, in download
    self.__download_wrapper(self.extract_info)(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3257, in wrapper
    res = func(*args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1422, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1431, in wrapper
    return func(self, *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1521, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1578, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2608, in process_video_result
    formats_to_download = list(format_selector({
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2120, in selector_function
    yield from f(ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2219, in final_selector
    return selector_function(ctx_copy)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2131, in selector_function
    picked_formats = list(f(ctx))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2120, in selector_function
    yield from f(ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2209, in selector_function
    yield matches[format_idx - 1]
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/utils.py", line 2696, in __getitem__
    self._cache.extend(itertools.islice(self._iterable, n))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2112, in _check_formats
    yield from self._check_formats(formats)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1883, in _check_formats
    success, _ = self.dl(temp_file.name, f, test=True)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2860, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/hls.py", line 82, in real_download
    self.report_error(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 971, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 903, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())


[info] Unable to download format hls-2374. Skipping...
[info] Testing format hls-2387
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 523
[download] Destination: /tmp/tmp7xw3trww.tmp
[download] 100% of 1.14MiB in 00:00
[info] 624202a9ec419d0008c30f90: Downloading 1 format(s): hls-2387
[info] Writing video subtitles to: Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt
[debug] Invoking hlsnative downloader on "https://siloh-aka.plutotv.net/081_MGM_Studios/clip/6241f908d5556100138457e4_Camelot/720pDRM/20220331_054603/hls/0-end/fp/en.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 492
[download] Destination: Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt
[download]  49.4% of ~96.36KiB at    1.04KiB/s ETA 01:05 (frag 243/492)ERROR: Unable to download video subtitles for 'en': [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/http/client.py", line 556, in _get_chunk_left
    chunk_left = self._read_next_chunk_size()
  File "/usr/local/lib/python3.8/http/client.py", line 523, in _read_next_chunk_size
    return int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/http/client.py", line 588, in _readinto_chunked
    chunk_left = self._get_chunk_left()
  File "/usr/local/lib/python3.8/http/client.py", line 558, in _get_chunk_left
    raise IncompleteRead(b'')
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 256, in download
    data_block = ctx.data.read(block_size if not is_test else min(block_size, data_len - byte_counter))
  File "/usr/local/lib/python3.8/http/client.py", line 459, in read
    n = self.readinto(b)
  File "/usr/local/lib/python3.8/http/client.py", line 493, in readinto
    return self._readinto_chunked(b)
  File "/usr/local/lib/python3.8/http/client.py", line 604, in _readinto_chunked
    raise IncompleteRead(bytes(b[0:total_bytes]))
http.client.IncompleteRead: IncompleteRead(310 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3897, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2860, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/hls.py", line 351, in real_download
    self.download_and_append_fragments(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 524, in download_and_append_fragments
    download_fragment(fragment, ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 459, in download_fragment
    if self._download_fragment(ctx, fragment['url'], info_dict, headers):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 125, in _download_fragment
    success, _ = ctx['dl'].download(fragment_filename, fragment_info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 376, in real_download
    return download()
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 258, in download
    retry(err)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 250, in retry
    else os.path.getsize(encodeFilename(ctx.tmpfilename)))
  File "/usr/local/lib/python3.8/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1431, in wrapper
    return func(self, *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1521, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1578, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2661, in process_video_result
    self.process_info(new_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2919, in process_info
    sub_files = self._write_subtitles(info_dict, temp_filename)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3905, in _write_subtitles
    raise DownloadError(msg)
yt_dlp.utils.DownloadError: Unable to download video subtitles for 'en': [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'
```

</details>
"ERROR: Unable to download video subtitles for 'en': [Errno 2] No such file or directory" with m3u8 webvtt subs
### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2022.07.18** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

I'm having an recurring issue where yt-dlp will fail to download a fragment, but error out because it can't find the downloaded fragment file instead of retrying the download. When it happens, if I re-run the command, yt-dlp retrieves the previously missing fragment and continues with the download normally. This sometimes doesn't happen for a stream. Sometimes several times in one stream. If I download the same stream multiple times, the error will occur for different fragments. It only happens with the vtt stream. The audio and video streams don't exhibit this issue.

For example:
(see https://github.com/yt-dlp/yt-dlp/issues/4521#issuecomment-1772146653)

<details>

ERROR: Unable to download video subtitles for 'en': [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'

When I immediately re-ran the command, Frag244 was downloaded without error and the download completed without issue.

I don't think this is the PlutoTV server returning a 404 or other error because when that's happened it's repeatable (the same fragment always fails) and the error yt-dlp gives in those cases is different. This error is almost like yt-dlp fully believes it downloaded Frag244 and is now surprised it's not there.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '-N', '1', '--check-formats', '--embed-subs', '--keep-fragments', '-o', '%(series)s/Season %(season_number)02d/%(series)s s%(season_number)02de%(episode_number)02d %(title)s.%(ext)s', 'https://pluto.tv/en/on-demand/series/stargate-sg-1-ptv1/season/9/episode/camelot-9-20']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.07.18 [135f05e]
[debug] Python 3.8.13 (CPython 64bit) - FreeBSD-12.3-RELEASE-p5-amd64-64bit-ELF (libc 7)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.05.18.1, mutagen-1.45.1, websockets-10.3
[debug] Proxy map: {}
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.07.18, Current version: 2022.07.18
yt-dlp is up to date (2022.07.18)
[debug] [PlutoTV] Extracting URL: https://pluto.tv/en/on-demand/series/stargate-sg-1-ptv1/season/9/episode/camelot-9-20
[PlutoTV] stargate-sg-1-ptv1: Downloading JSON metadata
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 information
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 playlist
[PlutoTV] 624202a9ec419d0008c30f90: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Downloading subtitles: en
[debug] Default format spec: bestvideo*+bestaudio/best
[info] Testing format hls-2374
[hlsnative] Downloading m3u8 manifest
ERROR: This video is DRM protected; Try selecting another format with --format or add --check-formats to automatically fallback to the next best format
  File "/home/melissa/.local/bin/yt-dlp", line 8, in <module>
    sys.exit(main())
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 940, in main
    _exit(*variadic(_real_main(argv)))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 932, in _real_main
    return ydl.download(all_urls)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3281, in download
    self.__download_wrapper(self.extract_info)(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3257, in wrapper
    res = func(*args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1422, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1431, in wrapper
    return func(self, *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1521, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1578, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2608, in process_video_result
    formats_to_download = list(format_selector({
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2120, in selector_function
    yield from f(ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2219, in final_selector
    return selector_function(ctx_copy)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2131, in selector_function
    picked_formats = list(f(ctx))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2140, in selector_function
    for pair in itertools.product(selector_1(ctx), selector_2(ctx)):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2209, in selector_function
    yield matches[format_idx - 1]
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/utils.py", line 2696, in __getitem__
    self._cache.extend(itertools.islice(self._iterable, n))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2112, in _check_formats
    yield from self._check_formats(formats)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1883, in _check_formats
    success, _ = self.dl(temp_file.name, f, test=True)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2860, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/hls.py", line 82, in real_download
    self.report_error(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 971, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 903, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())


[info] Unable to download format hls-2374. Skipping...
[info] Testing format hls-2387
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 523
[download] Destination: /tmp/tmpx2atrt6i.tmp
[download] 100% of 1.14MiB in 00:00
[info] Testing format hls-2374
[hlsnative] Downloading m3u8 manifest
ERROR: This video is DRM protected; Try selecting another format with --format or add --check-formats to automatically fallback to the next best format
  File "/home/melissa/.local/bin/yt-dlp", line 8, in <module>
    sys.exit(main())
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 940, in main
    _exit(*variadic(_real_main(argv)))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/__init__.py", line 932, in _real_main
    return ydl.download(all_urls)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3281, in download
    self.__download_wrapper(self.extract_info)(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3257, in wrapper
    res = func(*args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1422, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1431, in wrapper
    return func(self, *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1521, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1578, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2608, in process_video_result
    formats_to_download = list(format_selector({
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2120, in selector_function
    yield from f(ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2219, in final_selector
    return selector_function(ctx_copy)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2131, in selector_function
    picked_formats = list(f(ctx))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2120, in selector_function
    yield from f(ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2209, in selector_function
    yield matches[format_idx - 1]
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/utils.py", line 2696, in __getitem__
    self._cache.extend(itertools.islice(self._iterable, n))
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2112, in _check_formats
    yield from self._check_formats(formats)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1883, in _check_formats
    success, _ = self.dl(temp_file.name, f, test=True)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2860, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/hls.py", line 82, in real_download
    self.report_error(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 971, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 903, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())


[info] Unable to download format hls-2374. Skipping...
[info] Testing format hls-2387
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 523
[download] Destination: /tmp/tmp7xw3trww.tmp
[download] 100% of 1.14MiB in 00:00
[info] 624202a9ec419d0008c30f90: Downloading 1 format(s): hls-2387
[info] Writing video subtitles to: Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt
[debug] Invoking hlsnative downloader on "https://siloh-aka.plutotv.net/081_MGM_Studios/clip/6241f908d5556100138457e4_Camelot/720pDRM/20220331_054603/hls/0-end/fp/en.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 492
[download] Destination: Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt
[download]  49.4% of ~96.36KiB at    1.04KiB/s ETA 01:05 (frag 243/492)ERROR: Unable to download video subtitles for 'en': [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/http/client.py", line 556, in _get_chunk_left
    chunk_left = self._read_next_chunk_size()
  File "/usr/local/lib/python3.8/http/client.py", line 523, in _read_next_chunk_size
    return int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/http/client.py", line 588, in _readinto_chunked
    chunk_left = self._get_chunk_left()
  File "/usr/local/lib/python3.8/http/client.py", line 558, in _get_chunk_left
    raise IncompleteRead(b'')
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 256, in download
    data_block = ctx.data.read(block_size if not is_test else min(block_size, data_len - byte_counter))
  File "/usr/local/lib/python3.8/http/client.py", line 459, in read
    n = self.readinto(b)
  File "/usr/local/lib/python3.8/http/client.py", line 493, in readinto
    return self._readinto_chunked(b)
  File "/usr/local/lib/python3.8/http/client.py", line 604, in _readinto_chunked
    raise IncompleteRead(bytes(b[0:total_bytes]))
http.client.IncompleteRead: IncompleteRead(310 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3897, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2860, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/hls.py", line 351, in real_download
    self.download_and_append_fragments(
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 524, in download_and_append_fragments
    download_fragment(fragment, ctx)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 459, in download_fragment
    if self._download_fragment(ctx, fragment['url'], info_dict, headers):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 125, in _download_fragment
    success, _ = ctx['dl'].download(fragment_filename, fragment_info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 444, in download
    ret = self.real_download(filename, info_dict)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 376, in real_download
    return download()
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 258, in download
    retry(err)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 250, in retry
    else os.path.getsize(encodeFilename(ctx.tmpfilename)))
  File "/usr/local/lib/python3.8/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1431, in wrapper
    return func(self, *args, **kwargs)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1521, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1578, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2661, in process_video_result
    self.process_info(new_info)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2919, in process_info
    sub_files = self._write_subtitles(info_dict, temp_filename)
  File "/home/melissa/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3905, in _write_subtitles
    raise DownloadError(msg)
yt_dlp.utils.DownloadError: Unable to download video subtitles for 'en': [Errno 2] No such file or directory: 'Stargate SG-1/Season 09/Stargate SG-1 s09e20 Camelot.en.vtt.part-Frag244.part'
```

</details>


Discussion:
I also have this issue on 2023.10.13:

```
% yt-dlp -U
Available version: stable@2023.10.13, Current version: stable@2023.10.13
yt-dlp is up to date (stable@2023.10.13)
```

I can confirm it's not site-specific. I get it on the Rooster Teeth website.

Note that the error is a *local* `ENOENT`, not a 404 not found. Somehow, a fragment file yt-dlp is downloading doesn't exist. May be related to yt-dlp receiving an empty fragment or premature EOF and not handling that correctly.

```
% yt-dlp --verbose --no-abort-on-error --format='bestvideo*+bestaudio/best' --downloader-args ffmpeg:"-http_persistent 0" --downloader-args ffmpeg:"-loglevel warning -stats" --all-subs --embed-subs --add-metadata https://www.roosterteeth.com/watch/rwby-volume-6-10
[debug] Command-line config: ['--downloader-args', 'ffmpeg:-http_persistent 0', '--downloader-args', 'ffmpeg:-loglevel warning -stats', '--all-subs', '--embed-subs', '--format=701+258/701+140/299+258/299+140/137+258/137+140/22/18', '--add-metadata', '--verbose', '--no-abort-on-error', '--format=bestvideo*+bestaudio/best', 'https://www.roosterteeth.com/watch/rwby-volume-6-9', 'https://www.roosterteeth.com/watch/rwby-volume-6-10', 'https://www.roosterteeth.com/watch/rwby-volume-6-11', 'https://www.roosterteeth.com/watch/rwby-volume-6-13']
Deprecated Feature: Support for Python version 3.7 has been deprecated. See  https://github.com/yt-dlp/yt-dlp/issues/7803  for details.
                    You may stop receiving updates on this version at any time! Please update to Python 3.8 or above
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out UTF-8, error UTF-8, screen UTF-8
[debug] yt-dlp version stable@2023.10.13 [b634ba742] (pip)
[debug] Python 3.7.3 (CPython x86_64 64bit) - Darwin-21.6.0-x86_64-i386-64bit (OpenSSL 1.1.0j  20 Nov 2018)
[debug] exe versions: ffmpeg 4.1.1-tessus, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2021.05.30, mutagen-1.45.1, sqlite3-3.22.0, websockets-10.3
[debug] Proxy map: {}
[debug] Loaded 1890 extractors
[RoosterTeeth] Extracting URL: https://www.roosterteeth.com/watch/rwby-volume-6-10
[RoosterTeeth] rwby-volume-6-10: Downloading video JSON metadata
[RoosterTeeth] rwby-volume-6-10: Downloading m3u8 information
[RoosterTeeth] rwby-volume-6-10: Downloading episode JSON metadata
[info] 30121: Downloading subtitles: en, de, es, fr, pt
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[info] 30121: Downloading 1 format(s): hls-4602+hls-audio-3-en__Main_
Deleting existing file Stealing from the Elderly [30121].en.vtt
[info] Writing video subtitles to: Stealing from the Elderly [30121].en.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_en/media.m3u8?bc_token=NjUzMjIwMWRfMTIzYTA3NTUzMmE2MGFiZThlOTY5OWFjZDNhYTk2NTkyOTI4NTJkNTgwNmI0ZjQ1MzdkZmEwZGU2MzEwOWEzOA%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].en.vtt
[download] 100% of   13.33KiB in 00:00:01 at 7.45KiB/s
Deleting existing file Stealing from the Elderly [30121].de.vtt
[info] Writing video subtitles to: Stealing from the Elderly [30121].de.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_de/media.m3u8?bc_token=NjUzMjIwMWRfNjFjNDVhMDNmN2UzYmI0MWE3N2ViNGZjMjRlZjZlMjM2MWYwN2YxN2I2OWE4YjY5MmI2N2E0N2E4YmI3NzBmNQ%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].de.vtt
[download] 100% of   10.15KiB in 00:00:03 at 2.76KiB/s
Deleting existing file Stealing from the Elderly [30121].es.vtt
[info] Writing video subtitles to: Stealing from the Elderly [30121].es.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_es/media.m3u8?bc_token=NjUzMjIwMWRfMjRhZmJlZDc2MmNmMTkwZTMxYmJjYTAxMzZmMjhlZGRmMTljMzBhMTM1ZmU1YjcyY2VlOWQ0NGFkNjZhNDhlNw%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].es.vtt
[download] 100% of    9.10KiB in 00:00:03 at 2.96KiB/s
[info] Writing video subtitles to: Stealing from the Elderly [30121].fr.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_fr/media.m3u8?bc_token=NjUzMjIwMWRfMjMzYWFhMDE3OGNhMDU3YWU2NThhYWQxYzFmZTc5ODY0MDk3Y2VjMDllYjM5NmIzZTExOTVjZWU3M2U5NjQwNg%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].fr.vtt
[download] 100% of    8.66KiB in 00:00:01 at 5.16KiB/s
[info] Writing video subtitles to: Stealing from the Elderly [30121].pt.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_pt/media.m3u8?bc_token=NjUzMjIwMWRfNTFlYTk4M2Q3NzQ3MmI0ZjUwOGQ4MTcxZDExZDlmMDRkZDQ5NzFiMjE3NTYzYzliYmYxNzdmMGQ1ZGQ0ZmVkYg%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].pt.vtt
[download]  30.8% of ~  11.40KiB at    1.44KiB/s ETA 00:05 (frag 10/31)ERROR: Unable to download video subtitles for 'pt': [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 544, in _get_chunk_left
    chunk_left = self._read_next_chunk_size()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 511, in _read_next_chunk_size
    return int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 576, in _readinto_chunked
    chunk_left = self._get_chunk_left()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 546, in _get_chunk_left
    raise IncompleteRead(b'')
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/networking/_urllib.py", line 324, in read
    return self.fp.read(amt)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 447, in read
    n = self.readinto(b)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 481, in readinto
    return self._readinto_chunked(b)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 592, in _readinto_chunked
    raise IncompleteRead(bytes(b[0:total_bytes]))
http.client.IncompleteRead: IncompleteRead(564 bytes read)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 247, in download
    data_block = ctx.data.read(block_size if not is_test else min(block_size, data_len - byte_counter))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/networking/_urllib.py", line 326, in read
    handle_response_read_exceptions(e)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/networking/_urllib.py", line 340, in handle_response_read_exceptions
    raise IncompleteRead(partial=len(e.partial), cause=e, expected=e.expected) from e
yt_dlp.networking.exceptions.IncompleteRead: 564 bytes read

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 4211, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 3108, in dl
    return fd.download(name, new_info, subtitle)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/hls.py", line 373, in real_download
    ctx, fragments, info_dict, pack_func=pack_fragment, finish_func=fin_fragments)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 514, in download_and_append_fragments
    download_fragment(fragment, ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 464, in download_fragment
    ctx, fragment['url'], info_dict, headers, info_dict.get('request_data')):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 125, in _download_fragment
    success, _ = ctx['dl'].download(fragment_filename, fragment_info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 365, in real_download
    return download()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 249, in download
    retry(err)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 241, in retry
    else os.path.getsize(encodeFilename(ctx.tmpfilename)))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 1567, in wrapper
    return func(self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 1723, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 1782, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 2921, in process_video_result
    self.process_info(new_info)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 3175, in process_info
    sub_files = self._write_subtitles(info_dict, temp_filename)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 4219, in _write_subtitles
    raise DownloadError(msg)
yt_dlp.utils.DownloadError: Unable to download video subtitles for 'pt': [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
```

The first exception in that chain of exceptions is:

```
[download]  30.8% of ~  11.40KiB at    1.44KiB/s ETA 00:05 (frag 10/31)ERROR: Unable to download video subtitles for 'pt': [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 544, in _get_chunk_left
    chunk_left = self._read_next_chunk_size()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 511, in _read_next_chunk_size
    return int(line, 16)
ValueError: invalid literal for int() with base 16: b''
```

And the last one is:

```
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 4211, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 3108, in dl
    return fd.download(name, new_info, subtitle)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/hls.py", line 373, in real_download
    ctx, fragments, info_dict, pack_func=pack_fragment, finish_func=fin_fragments)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 514, in download_and_append_fragments
    download_fragment(fragment, ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 464, in download_fragment
    ctx, fragment['url'], info_dict, headers, info_dict.get('request_data')):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 125, in _download_fragment
    success, _ = ctx['dl'].download(fragment_filename, fragment_info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 365, in real_download
    return download()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 249, in download
    retry(err)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 241, in retry
    else os.path.getsize(encodeFilename(ctx.tmpfilename)))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
```
Also, repeatedly attempting the same video eventually succeeds. It's like I'm gradually warming up some cache that the subs are being served from.

Best way to repro is to download an entire series or something, probably one of the older or less-popular ones (I'm downloading “RWBY” which is several years old). Sooner or later, you'll hit this on some video, and probably be able to hit it a few times before all the subs eventually succeed and yt-dlp proceeds to download the video and audio streams.
I particularly encountered this on “RWBY” seasons 3 through 7. 1, 2, and 8 all downloaded without trouble.
I also have this issue on 2023.10.13:

```
% yt-dlp -U
Available version: stable@2023.10.13, Current version: stable@2023.10.13
yt-dlp is up to date (stable@2023.10.13)
```

I can confirm it's not site-specific. I get it on the Rooster Teeth website.

Note that the error is a *local* `ENOENT`, not a 404 not found. Somehow, a fragment file yt-dlp is downloading doesn't exist. May be related to yt-dlp receiving an empty fragment or premature EOF and not handling that correctly.

```
% yt-dlp --verbose --no-abort-on-error --format='bestvideo*+bestaudio/best' --downloader-args ffmpeg:"-http_persistent 0" --downloader-args ffmpeg:"-loglevel warning -stats" --all-subs --embed-subs --add-metadata https://www.roosterteeth.com/watch/rwby-volume-6-10
[debug] Command-line config: ['--downloader-args', 'ffmpeg:-http_persistent 0', '--downloader-args', 'ffmpeg:-loglevel warning -stats', '--all-subs', '--embed-subs', '--format=701+258/701+140/299+258/299+140/137+258/137+140/22/18', '--add-metadata', '--verbose', '--no-abort-on-error', '--format=bestvideo*+bestaudio/best', 'https://www.roosterteeth.com/watch/rwby-volume-6-9', 'https://www.roosterteeth.com/watch/rwby-volume-6-10', 'https://www.roosterteeth.com/watch/rwby-volume-6-11', 'https://www.roosterteeth.com/watch/rwby-volume-6-13']
Deprecated Feature: Support for Python version 3.7 has been deprecated. See  https://github.com/yt-dlp/yt-dlp/issues/7803  for details.
                    You may stop receiving updates on this version at any time! Please update to Python 3.8 or above
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out UTF-8, error UTF-8, screen UTF-8
[debug] yt-dlp version stable@2023.10.13 [b634ba742] (pip)
[debug] Python 3.7.3 (CPython x86_64 64bit) - Darwin-21.6.0-x86_64-i386-64bit (OpenSSL 1.1.0j  20 Nov 2018)
[debug] exe versions: ffmpeg 4.1.1-tessus, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2021.05.30, mutagen-1.45.1, sqlite3-3.22.0, websockets-10.3
[debug] Proxy map: {}
[debug] Loaded 1890 extractors
[RoosterTeeth] Extracting URL: https://www.roosterteeth.com/watch/rwby-volume-6-10
[RoosterTeeth] rwby-volume-6-10: Downloading video JSON metadata
[RoosterTeeth] rwby-volume-6-10: Downloading m3u8 information
[RoosterTeeth] rwby-volume-6-10: Downloading episode JSON metadata
[info] 30121: Downloading subtitles: en, de, es, fr, pt
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[info] 30121: Downloading 1 format(s): hls-4602+hls-audio-3-en__Main_
Deleting existing file Stealing from the Elderly [30121].en.vtt
[info] Writing video subtitles to: Stealing from the Elderly [30121].en.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_en/media.m3u8?bc_token=NjUzMjIwMWRfMTIzYTA3NTUzMmE2MGFiZThlOTY5OWFjZDNhYTk2NTkyOTI4NTJkNTgwNmI0ZjQ1MzdkZmEwZGU2MzEwOWEzOA%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].en.vtt
[download] 100% of   13.33KiB in 00:00:01 at 7.45KiB/s
Deleting existing file Stealing from the Elderly [30121].de.vtt
[info] Writing video subtitles to: Stealing from the Elderly [30121].de.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_de/media.m3u8?bc_token=NjUzMjIwMWRfNjFjNDVhMDNmN2UzYmI0MWE3N2ViNGZjMjRlZjZlMjM2MWYwN2YxN2I2OWE4YjY5MmI2N2E0N2E4YmI3NzBmNQ%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].de.vtt
[download] 100% of   10.15KiB in 00:00:03 at 2.76KiB/s
Deleting existing file Stealing from the Elderly [30121].es.vtt
[info] Writing video subtitles to: Stealing from the Elderly [30121].es.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_es/media.m3u8?bc_token=NjUzMjIwMWRfMjRhZmJlZDc2MmNmMTkwZTMxYmJjYTAxMzZmMjhlZGRmMTljMzBhMTM1ZmU1YjcyY2VlOWQ0NGFkNjZhNDhlNw%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].es.vtt
[download] 100% of    9.10KiB in 00:00:03 at 2.96KiB/s
[info] Writing video subtitles to: Stealing from the Elderly [30121].fr.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_fr/media.m3u8?bc_token=NjUzMjIwMWRfMjMzYWFhMDE3OGNhMDU3YWU2NThhYWQxYzFmZTc5ODY0MDk3Y2VjMDllYjM5NmIzZTExOTVjZWU3M2U5NjQwNg%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].fr.vtt
[download] 100% of    8.66KiB in 00:00:01 at 5.16KiB/s
[info] Writing video subtitles to: Stealing from the Elderly [30121].pt.vtt
[debug] Invoking hlsnative downloader on "https://ssaimanifest.prod.boltdns.net/us-east-1/playback/once/v1/hls/v4/clear/6203312018001/ddc307e2-0354-47b3-861c-073c2c03cae5/818e4c16-062e-47a0-b373-df7a9b62704a/cc6f0bb5-2ae3-4647-90d7-9d9bedbea1ae/subtitle_pt/media.m3u8?bc_token=NjUzMjIwMWRfNTFlYTk4M2Q3NzQ3MmI0ZjUwOGQ4MTcxZDExZDlmMDRkZDQ5NzFiMjE3NTYzYzliYmYxNzdmMGQ1ZGQ0ZmVkYg%3D%3D"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 31
[download] Destination: Stealing from the Elderly [30121].pt.vtt
[download]  30.8% of ~  11.40KiB at    1.44KiB/s ETA 00:05 (frag 10/31)ERROR: Unable to download video subtitles for 'pt': [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 544, in _get_chunk_left
    chunk_left = self._read_next_chunk_size()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 511, in _read_next_chunk_size
    return int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 576, in _readinto_chunked
    chunk_left = self._get_chunk_left()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 546, in _get_chunk_left
    raise IncompleteRead(b'')
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/networking/_urllib.py", line 324, in read
    return self.fp.read(amt)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 447, in read
    n = self.readinto(b)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 481, in readinto
    return self._readinto_chunked(b)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 592, in _readinto_chunked
    raise IncompleteRead(bytes(b[0:total_bytes]))
http.client.IncompleteRead: IncompleteRead(564 bytes read)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 247, in download
    data_block = ctx.data.read(block_size if not is_test else min(block_size, data_len - byte_counter))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/networking/_urllib.py", line 326, in read
    handle_response_read_exceptions(e)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/networking/_urllib.py", line 340, in handle_response_read_exceptions
    raise IncompleteRead(partial=len(e.partial), cause=e, expected=e.expected) from e
yt_dlp.networking.exceptions.IncompleteRead: 564 bytes read

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 4211, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 3108, in dl
    return fd.download(name, new_info, subtitle)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/hls.py", line 373, in real_download
    ctx, fragments, info_dict, pack_func=pack_fragment, finish_func=fin_fragments)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 514, in download_and_append_fragments
    download_fragment(fragment, ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 464, in download_fragment
    ctx, fragment['url'], info_dict, headers, info_dict.get('request_data')):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 125, in _download_fragment
    success, _ = ctx['dl'].download(fragment_filename, fragment_info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 365, in real_download
    return download()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 249, in download
    retry(err)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 241, in retry
    else os.path.getsize(encodeFilename(ctx.tmpfilename)))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 1567, in wrapper
    return func(self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 1723, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 1782, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 2921, in process_video_result
    self.process_info(new_info)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 3175, in process_info
    sub_files = self._write_subtitles(info_dict, temp_filename)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 4219, in _write_subtitles
    raise DownloadError(msg)
yt_dlp.utils.DownloadError: Unable to download video subtitles for 'pt': [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
```

The first exception in that chain of exceptions is:

```
[download]  30.8% of ~  11.40KiB at    1.44KiB/s ETA 00:05 (frag 10/31)ERROR: Unable to download video subtitles for 'pt': [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 544, in _get_chunk_left
    chunk_left = self._read_next_chunk_size()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 511, in _read_next_chunk_size
    return int(line, 16)
ValueError: invalid literal for int() with base 16: b''
```

And the last one is:

```
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 4211, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/YoutubeDL.py", line 3108, in dl
    return fd.download(name, new_info, subtitle)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/hls.py", line 373, in real_download
    ctx, fragments, info_dict, pack_func=pack_fragment, finish_func=fin_fragments)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 514, in download_and_append_fragments
    download_fragment(fragment, ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 464, in download_fragment
    ctx, fragment['url'], info_dict, headers, info_dict.get('request_data')):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/fragment.py", line 125, in _download_fragment
    success, _ = ctx['dl'].download(fragment_filename, fragment_info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 365, in real_download
    return download()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 249, in download
    retry(err)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yt_dlp/downloader/http.py", line 241, in retry
    else os.path.getsize(encodeFilename(ctx.tmpfilename)))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: 'Stealing from the Elderly [30121].pt.vtt.part-Frag11.part'
```
Also, repeatedly attempting the same video eventually succeeds. It's like I'm gradually warming up some cache that the subs are being served from.

Best way to repro is to download an entire series or something, probably one of the older or less-popular ones (I'm downloading “RWBY” which is several years old). Sooner or later, you'll hit this on some video, and probably be able to hit it a few times before all the subs eventually succeed and yt-dlp proceeds to download the video and audio streams.
I particularly encountered this on “RWBY” seasons 3 through 7. 1, 2, and 8 all downloaded without trouble.

Resolving patch:
diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.py
--- a/yt_dlp/downloader/http.py
+++ b/yt_dlp/downloader/http.py
@@ -237,8 +237,13 @@ def download():
 
             def retry(e):
                 close_stream()
-                ctx.resume_len = (byte_counter if ctx.tmpfilename == '-'
-                                  else os.path.getsize(encodeFilename(ctx.tmpfilename)))
+                if ctx.tmpfilename == '-':
+                    ctx.resume_len = byte_counter
+                else:
+                    try:
+                        ctx.resume_len = os.path.getsize(encodeFilename(ctx.tmpfilename))
+                    except FileNotFoundError:
+                        ctx.resume_len = 0
                 raise RetryDownload(e)
 
             while True:


Test patch: