{"id":"23009cf77ccd8efa","repo":"aio-libs/aiohttp","slug":"no-proxies-found-for-url-s-in-the-env","errorCode":null,"errorMessage":"No proxies found for `{url!s}` in the env","messagePattern":"No proxies found for `(.+?)` in the env","errorType":"exception","errorClass":"LookupError","httpStatus":null,"severity":"warning","filePath":"aiohttp/helpers.py","lineNumber":299,"sourceCode":"            if proxy.host is not None:\n                try:\n                    auth = _auth_header_from_netrc(netrc_obj, proxy.host)\n                except LookupError:\n                    auth = None\n        ret[proto] = ProxyInfo(proxy, auth)\n    return ret\n\n\ndef get_env_proxy_for_url(url: URL) -> tuple[URL, str | None]:\n    \"\"\"Get a permitted proxy for the given URL from the env.\"\"\"\n    if url.host is not None and proxy_bypass(url.host):\n        raise LookupError(f\"Proxying is disallowed for `{url.host!r}`\")\n\n    proxies_in_env = proxies_from_env()\n    try:\n        proxy_info = proxies_in_env[url.scheme]\n    except KeyError:\n        raise LookupError(f\"No proxies found for `{url!s}` in the env\")\n    else:\n        return proxy_info.proxy, proxy_info.proxy_auth\n\n\n@frozen_dataclass_decorator\nclass MimeType:\n    type: str\n    subtype: str\n    suffix: str\n    parameters: \"MultiDictProxy[str]\"\n\n\n@functools.lru_cache(maxsize=56)\ndef parse_mimetype(mimetype: str) -> MimeType:\n    \"\"\"Parses a MIME type into its components.\n\n    mimetype is a MIME type string.\n","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/c0ef574e29109210e96e652771ae4e7b88615fa4/aiohttp/helpers.py#L281-L317","documentation":"Raised by get_env_proxy_for_url when proxies_from_env() returns a dict that has no entry for url.scheme (no matching http/https/ws/wss env proxy). LookupError; the URL is not in a bypass list but no proxy is configured for its scheme either.","triggerScenarios":"Only HTTP_PROXY is set but the URL scheme is https (or vice versa); only ALL_PROXY set (aiohttp reads scheme-specific vars); ws/wss schemes with no WS_PROXY. getproxies() yields nothing for that scheme.","commonSituations":"Mixing HTTPS_PROXY/HTTP_PROXY casing on case-sensitive OSes; setting ALL_PROXY expecting aiohttp to honor it; targeting ws:// without WS_PROXY.","solutions":["Set the scheme-specific env var: HTTPS_PROXY for https URLs, HTTP_PROXY for http.","Verify with 'echo $HTTPS_PROXY' (case matters on Linux).","Don't call get_env_proxy_for_url unless you know a proxy applies for that scheme."],"exampleFix":"// before\n# only HTTP_PROXY set, calling for https:// url\n// after\nexport HTTPS_PROXY=http://proxy.local:8080","handlingStrategy":"validation","validationCode":"import os\nneeded = {'https': 'HTTPS_PROXY', 'http': 'HTTP_PROXY', 'ws': 'WS_PROXY', 'wss': 'WSS_PROXY'}\nvar = needed.get(url.scheme)\nif var and not os.environ.get(var):\n    raise EnvironmentError(f'set {var} for {url.scheme} requests')","typeGuard":null,"tryCatchPattern":"try:\n    proxy, auth = get_env_proxy_for_url(url)\nexcept LookupError:\n    proxy, auth = None, None  # direct connection","preventionTips":["Set scheme-specific proxy env vars (HTTP_PROXY / HTTPS_PROXY).","Remember env var names are case-sensitive on Linux.","Don't assume ALL_PROXY is honored; use the scheme-specific var."],"tags":["proxy","env","config","scheme"],"analyzedSha":"c0ef574e29109210e96e652771ae4e7b88615fa4","analyzedAt":"2026-08-04T19:51:05.467Z","schemaVersion":2}