Repository: yt-dlp
Issue: Do not skip fragments on filesystem errors
Labels: enhancement,core:downloader

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2023.03.04** ([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/yt-dlp/yt-dlp/wiki/FAQ#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 [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and 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

When disk space becomes insufficient, yt-dlp says:

```
ERROR: unable to write data: [Errno 28] No space left on device
OSError: [Errno 28] No space left on device
[download] fragment not found; Skipping fragment 330 ...
```

In most cases, it doesn't make sense to skip the fragment, because:
* the following fragments will suffer from the problem of insufficient disk space and
* a part of the download will be missing and/or
* the audio/video may become out-of-sync if the fragment was from an audio-only or video-only track.

### solution

When running out of disk space, yt-dlp should either
* **pause** to give the user a chance to free some disk space or
* **abort**, so that the user can resume the download after having freed some disk space

### related issues
* #3730 
* #6757
* #6793 
* #6078




### 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] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

```shell
[debug] Command-line config: ['https://dms.redbull.tv/v5/destination/stv/AAWCVHH74J0J0A0TBSDD/personal_computer/http/at/de_AT/playlist.m3u8', '-f-']
[debug] Portable config "c:\hp\-\!portableapps\yt-dlp\yt-dlp.conf": ['--verbose', '--format-sort', 'hasvid,ie_pref,quality,res,hdr,codec,size,br,asr,ext,fps,hasaud,lang,source,proto,id', '-f', 'bestvideo*+bestaudio/best', '-f-', '--paths', 'c:\\hp\\-\\#YT', '--ffmpeg-location', '.\\helpertools\\FFmpeg\\bin', '-o', '.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'thumbnail:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\thumbs\\thumb.%(ext)s', '-o', 'subtitle:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\subs\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'infojson:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'link:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'description:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'annotation:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'pl_infojson:.\\%(playlist|)s\\playlist.%(ext)s', '-o', 'pl_thumbnail:.\\%(playlist|)s\\folder.%(ext)s', '-o', 'pl_description:.\\%(playlist|)s\\playlist description.%(ext)s', '--output-na-placeholder', '~~~', '--write-info-json', '--write-description', '--write-annotations', '--no-overwrites', '--no-post-overwrites', '--merge-output-format', 'mkv', '--remux-video', 'mkv', '--write-subs', '--write-auto-subs', '--all-subs', '--sub-langs', 'all', '--sub-format', 'all/ttml/vtt/best', '--write-thumbnail', '--write-all-thumbnails', '--embed-metadata', '--embed-chapters', '--no-embed-info-json', '--write-link', '--write-url-link', '--write-desktop-link', '--no-check-certificate', '--retries', 'infinite', '--geo-bypass', '--geo-bypass-country', 'AT', '--no-clean-infojson', '--write-comments', '--audio-multistreams', '--no-playlist']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-110185-gb564ad8eac-20230407 (setts), ffprobe N-110185-gb564ad8eac-20230407
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Using fake IP 77.119.119.20 (AT) as X-Forwarded-For
[generic] Extracting URL: https://dms.redbull.tv/v5/destination/stv/AAWCVHH74J0J0A0TBSDD/personal_computer/http/at/de_AT/playlist.m3u8
[generic] playlist: Downloading webpage
[debug] Identified a direct video link
[generic] playlist: Downloading m3u8 information
[debug] Sort order given by user: hasvid, ie_pref, quality, res, hdr, codec, size, br, asr, ext, fps, hasaud, lang, source, proto, id
[debug] Formats sorted by: hasvid, ie_pref, quality, res, hdr, vcodec, acodec, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, fps, hasaud, lang, source, proto, id, channels
[info] Available formats for playlist:
ID                       EXT RESOLUTION FPS │   TBR PROTO │ VCODEC        VBR ACODEC     MORE INFO
─────────────────────────────────────────────────────────────────────────────────────────────────────
audio-stereo-aac-Deutsch mp4 audio only     │       m3u8  │ audio only        unknown    [de] Deutsch
518                      mp4 426x240     25 │  518k m3u8  │ avc1.4D401E  518k video only
848                      mp4 640x360     25 │  848k m3u8  │ avc1.4D401E  848k video only
1507                     mp4 960x540     25 │ 1507k m3u8  │ avc1.4D401F 1507k video only
2927                     mp4 1280x720    25 │ 2928k m3u8  │ avc1.4D401F 2928k video only
6152                     mp4 1920x1080   25 │ 6152k m3u8  │ avc1.640028 6152k video only

Enter format selector: bv+ba
[info] playlist: Downloading 1 format(s): 6152+audio-stereo-aac-Deutsch
[info] There's no video description to write
[info] There's no subtitles for the requested languages
[info] There's no video thumbnails to download
[info] Writing video metadata as JSON to: c:\hp\-\#YT\#nodate# playlist\!nfo\playlist [generic.Generic.playlist] [6152+audio-stereo-aac-Deutsch].info.json
WARNING: There are no annotations to write.
[info] Writing internet shortcut (.url) to: c:\hp\-\#YT\#nodate# playlist\!nfo\playlist [generic.Generic.playlist] [6152+audio-stereo-aac-Deutsch].url
[info] Writing internet shortcut (.desktop) to: c:\hp\-\#YT\#nodate# playlist\!nfo\playlist [generic.Generic.playlist] [6152+audio-stereo-aac-Deutsch].desktop
[debug] Invoking hlsnative downloader on "https://dms.redbull.tv/v5/dms/media/vod/stv/AAWCVHH74J0J0A0TBSDD/1920x1080@7292803/personal_computer/http/at/playlist.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 620
[download] Destination: c:\hp\-\#YT\#nodate# playlist\playlist [generic.Generic.playlist] [6152+audio-stereo-aac-Deutsch].f6152.mp4
[debug] File locking is not supported. Proceeding without locking
[download]  53.1% of ~   1.29GiB at   75.04KiB/s ETA 01:36:08 (frag 329/620)

ERROR: unable to write data: [Errno 28] No space left on device
Traceback (most recent call last):
  File "yt_dlp\downloader\http.py", line 288, in download
OSError: [Errno 28] No space left on device

[download] fragment not found; Skipping fragment 330 ...
[download]  54.0% of ~   1.29GiB at  138.58KiB/s ETA 01:34:39 (frag 334/620)
ERROR: Interrupted by user
```