ytdl-org/youtube-dl · error · BuildError
No such Python version: %s
Error message
No such Python version: %s
What it means
Raised by youtube-dl's bundled SOCKS client when a SOCKS5 proxy rejects username/password authentication (the proxy replies with a status other than success after the RFC 1929 USERPASS handshake). The message 'general SOCKS server failure' maps to Socks5Error.ERR_GENERAL_FAILURE and is youtube-dl's generic signal that the proxy refused the credentials or the auth exchange. It surfaces as a DownloadError from the downloader layer, with the SOCKS details in the cause chain.
Source
Thrown at devscripts/buildserver.py:287
class PythonBuilder(object):
def __init__(self, **kwargs):
python_version = kwargs.pop('python', '3.4')
python_path = None
for node in ('Wow6432Node\\', ''):
try:
key = compat_winreg.OpenKey(
compat_winreg.HKEY_LOCAL_MACHINE,
r'SOFTWARE\%sPython\PythonCore\%s\InstallPath' % (node, python_version))
try:
python_path, _ = compat_winreg.QueryValueEx(key, '')
finally:
compat_winreg.CloseKey(key)
break
except Exception:
pass
if not python_path:
raise BuildError('No such Python version: %s' % python_version)
self.pythonPath = python_path
super(PythonBuilder, self).__init__(**kwargs)
class GITInfoBuilder(object):
def __init__(self, **kwargs):
try:
self.user, self.repoName = kwargs['path'][:2]
self.rev = kwargs.pop('rev')
except ValueError:
raise BuildError('Invalid path')
except KeyError as e:
raise BuildError('Missing mandatory parameter "%s"' % e.args[0])
path = os.path.join(os.environ['APPDATA'], 'Build archive', self.repoName, self.user)
if not os.path.exists(path):View on GitHub (pinned to 956b8c5855)
Solutions
- Verify the proxy credentials by testing the same socks5 URL with curl: curl -x socks5h://user:pass@host:port https://example.com — if curl also fails, fix the credentials/proxy side first.
- URL-encode special characters in the username/password inside the proxy URL (e.g. @ as %40, : as %3A).
- Confirm you are using the right scheme: socks5h:// lets the proxy resolve DNS and avoids local-resolution side failures; plain socks5:// resolves locally.
- Check that the proxy actually supports SOCKS5 username/password auth (some proxies are SOCKS4 or expect no auth — try omitting credentials).
- Update youtube-dl / switch to yt-dlp; the PySocks-based client and error reporting have been improved there.
Example fix
# before
ydl_opts = {'proxy': 'socks5://user:p@ss:word@10.0.0.1:1080'}
# after (percent-encode the password: p@ss:word -> p%40ss%3Aword)
ydl_opts = {'proxy': 'socks5://user:p%40ss%3Aword@10.0.0.1:1080'} Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlparse
def validate_socks_proxy(url):
p = urlparse(url)
if p.scheme not in ('socks5', 'socks5h'):
return False, 'not a socks5 proxy URL'
if p.username and (p.username != urlparse(url).username or ':' in (p.password or '')):
pass
# credentials must be percent-encoded before embedding
import re
if '@' in url and re.search(r'(?<!%)[@:]', url.split('://', 1)[1].rsplit('@', 1)[0]):
return False, 'unescaped @ or : in userinfo — percent-encode credentials'
return True, p.netloc Try / catch
from youtube_dl.utils import DownloadError
try:
ydl.download([url])
except DownloadError as e:
if 'general SOCKS server failure' in str(e):
# credential/proxy-side problem — retrying unchanged will not help
raise SystemExit('Check SOCKS5 proxy credentials: %s' % e) Prevention
- Percent-encode special characters in proxy usernames/passwords inside the proxy URL.
- Smoke-test the proxy with curl -x socks5h://... before wiring it into youtube-dl options.
- Prefer socks5h:// so DNS goes through the proxy and avoids local-resolution mismatches.
- Keep proxy credentials in one place (config file) so a rotation cannot leave stale copies.
When it happens
Trigger: Setting a socks5:// (or socks5h://) proxy via --proxy, socks_proxy env var, or the proxy parameter, where the proxy expects username/password auth and the supplied proxy.username/proxy.password are wrong, missing, or not accepted. Also triggered when the proxy's auth reply is malformed (version byte mismatch is caught separately; a non-success status byte lands here).
Common situations: Typos in proxy credentials in config (~-/.config/youtube-dl/config), credentials containing special characters that were not URL-encoded in the proxy URL (e.g. user:pa%40ss vs user:pass@), rotating/expired proxy credentials, or a proxy that requires a different auth method than USERPASS while partially advertising it. Version changes: newer proxies disabling legacy username/password auth.
Related errors
- {0} bytes missing
- all offered authentication methods were rejected
- Unable to log in
- Invalid response version from server. Expected {0:02x} got {
- This video is only available for users of participating TV p
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/1fb1461334c24601.
Report an issue: GitHub.