yt-dlp: EILSEQ error in macOS due to some emojis in the title like
Checklist
- I’m reporting a bug unrelated to a specific site
- I’ve verified that I have updated yt-dlp to nightly or master (update instructions)
- I’ve searched known issues, the FAQ, and the bugtracker for similar issues including closed ones. DO NOT post duplicates
Provide a description that is worded well enough to be understood
When the title contain certain emoji it fails in macOS. Related to https://github.com/DmitryScaletta/twitch-dlp/issues/45
Provide verbose output that clearly demonstrates the problem
- Run your yt-dlp command with -vU flag added (
yt-dlp -vU <your command line>) - If using API, add
'verbose': TruetoYoutubeDLparams instead - Copy the WHOLE output (starting with
[debug] Command-line config) and insert it below
Complete Verbose Output
% yt-dlp -vU 'https://www.twitch.tv/officialkaybihtv/video/2466588925'
[debug] Command-line config: ['-vU', 'https://www.twitch.tv/officialkaybihtv/video/2466588925']
[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@2025.05.22 from yt-dlp/yt-dlp [7977b329e] (pip)
[debug] Python 3.13.3 (CPython arm64 64bit) - macOS-15.5-arm64-arm-64bit-Mach-O (OpenSSL 3.5.0 8 Apr 2025)
[debug] exe versions: ffmpeg 7.1.1 (setts), ffprobe 7.1.1, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.23.0, brotli-1.1.0, certifi-2025.04.26, mutagen-1.47.0, requests-2.32.3, sqlite3-3.49.2, urllib3-2.4.0, websockets-15.0.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Plugin directories: none
[debug] Loaded 1859 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2025.05.22 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2025.05.22 from yt-dlp/yt-dlp)
[twitch:vod] Extracting URL: https://www.twitch.tv/officialkaybihtv/video/2466588925
[twitch:vod] 2466588925: Downloading stream metadata GraphQL
[twitch:vod] 2466588925: Downloading video access token GraphQL
[twitch:vod] 2466588925: Downloading m3u8 information
[twitch:vod] 2466588925: Downloading storyboard metadata JSON
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec, channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] v2466588925: Downloading 1 format(s): 720p-1
[debug] Invoking hlsnative downloader on "https://d2nvs31859zcd8.cloudfront.net/3e9b45cf7aa7fbe73a2d_officialkaybihtv_321491038972_1748038265/chunked/index-muted-4V3K6BN2AI.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 71
[download] Destination: THE LIT STREAM UNIVERSITY‼️ [v2466588925].mp4
ERROR: Unable to download video: [Errno 92] Illegal byte sequence: 'THE LIT STREAM UNIVERSITY‼️\U0001fadf [v2466588925].mp4.ytdl'
Traceback (most recent call last):
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/utils/_utils.py", line 606, in sanitize_open
stream = locked_file(filename, open_mode, block=False).__enter__()
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/utils/_utils.py", line 1621, in __init__
self.f = os.fdopen(os.open(filename, flags, 0o666), mode, encoding=encoding)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 92] Illegal byte sequence: 'THE LIT STREAM UNIVERSITY‼️\U0001fadf [v2466588925].mp4.ytdl'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3517, in process_info
success, real_download = self.dl(temp_filename, info_dict)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3237, in dl
return fd.download(name, new_info, subtitle)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/common.py", line 468, in download
ret = self.real_download(filename, info_dict)
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/hls.py", line 171, in real_download
self._prepare_and_start_frag_download(ctx, info_dict)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/fragment.py", line 76, in _prepare_and_start_frag_download
self._prepare_frag_download(ctx)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/fragment.py", line 212, in _prepare_frag_download
self._write_ytdl_file(ctx)
~~~~~~~~~~~~~~~~~~~~~^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/fragment.py", line 96, in _write_ytdl_file
frag_index_stream, _ = self.sanitize_open(self.ytdl_filename(ctx['filename']), 'w')
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/common.py", line 249, in wrapper
retry.error_callback(err, 1, 0)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/common.py", line 235, in error_callback
return RetryManager.report_retry(
~~~~~~~~~~~~~~~~~~~~~~~~~^
err, count, retries, info=fd.__to_screen,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warn=lambda e: (time.sleep(0.01), fd.to_screen(f'[download] Unable to {action} file: {e}')),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error=None if fatal else lambda e: fd.report_error(f'Unable to {action} file: {e}'),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sleep_func=fd.params.get('retry_sleep_functions', {}).get('file_access'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/utils/_utils.py", line 5260, in report_retry
raise e
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/common.py", line 244, in wrapper
return func(self, *args, **kwargs)
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/downloader/common.py", line 255, in sanitize_open
f, filename = sanitize_open(filename, open_mode)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/utils/_utils.py", line 608, in sanitize_open
stream = open(filename, open_mode)
OSError: [Errno 92] Illegal byte sequence: 'THE LIT STREAM UNIVERSITY‼️\U0001fadf [v2466588925].mp4.ytdl'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1662, in wrapper
return func(self, *args, **kwargs)
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1818, in __extract_info
return self.process_ie_result(ie_result, download, extra_info)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1877, in process_ie_result
ie_result = self.process_video_result(ie_result, download=download)
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3049, in process_video_result
self.process_info(new_info)
~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 185, in wrapper
return func(self, *args, **kwargs)
File "/opt/homebrew/Cellar/yt-dlp/2025.5.22/libexec/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3529, in process_info
raise UnavailableVideoError(err)
yt_dlp.utils.UnavailableVideoError: Unable to download video: [Errno 92] Illegal byte sequence: 'THE LIT STREAM UNIVERSITY‼️\U0001fadf [v2466588925].mp4.ytdl'
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 21 (9 by maintainers)
I think the best way to fix this is to check if all graphemes involved can be written to destination filesystem, like I’ve suggested to others projects: https://github.com/DmitryScaletta/twitch-dlp/issues/46