{"record":{"id":"7aaf7d9a6e0c4620","repo":"Graphify-Labs/graphify","slug":"proxy-error-exc","errorCode":null,"errorMessage":"Proxy error: {exc}","messagePattern":"Proxy error: (.+?)","errorType":"exception","errorClass":"TransportError","httpStatus":null,"severity":"error","filePath":"worked/httpx/raw/transport.py","lineNumber":132,"sourceCode":"\n\nclass ProxyTransport(BaseTransport):\n    \"\"\"\n    Routes requests through an HTTP/HTTPS proxy.\n    Wraps an inner transport and prepends proxy connection handling.\n    \"\"\"\n\n    def __init__(self, proxy_url: str, *, inner: BaseTransport = None):\n        self.proxy_url = proxy_url\n        self._inner = inner or HTTPTransport()\n\n    def handle_request(self, request: Request) -> Response:\n        try:\n            return self._inner.handle_request(request)\n        except TransportError:\n            raise\n        except Exception as exc:\n            raise TransportError(f\"Proxy error: {exc}\") from exc\n\n    def close(self) -> None:\n        self._inner.close()\n","sourceCodeStart":114,"sourceCodeEnd":136,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/worked/httpx/raw/transport.py#L114-L136","documentation":"worked/httpx's proxy transport wrapper (ProxyTransport in worked/httpx/raw/transport.py) delegates handle_request() to an inner BaseTransport. TransportError subclasses are re-raised untouched, but any other exception escaping the inner transport — connection failures, TLS errors, DNS errors from the underlying stack — is wrapped in a generic TransportError prefixed 'Proxy error: ' with the original exception chained. It signals that the request failed at the transport layer while going through the proxy, with the real cause in __cause__.","triggerScenarios":"Sending a request through ProxyTransport when the inner HTTPTransport raises a non-TransportError exception: unreachable proxy host, refused proxy port, TLS handshake failure to the proxy or target, or an invalid proxy URL that surfaces as a socket/SSL error.","commonSituations":"HTTP(S)_PROXY env var pointing at a dead local proxy (e.g. a stopped mitmproxy/Colima/kind daemon); corporate proxy requiring CONNECT that is misconfigured; SOCKS-only proxy given an http:// URL without socks extra installed; firewall blocking the proxy port.","solutions":["Verify the proxy is reachable and listening: curl -x <proxy_url> <target_url> from the same machine","Check the proxy_url scheme/host/port for typos and confirm the protocol (http vs socks5) matches the actual proxy","Inspect the chained cause (`except TransportError as e: print(e.__cause__)`) — it names the real failure (DNS, connection refused, SSL)","If the proxy is optional, retry without ProxyTransport (plain HTTPTransport) or disable the proxy env vars for the request"],"exampleFix":"# before\ntransport = ProxyTransport('http://127.0.0.1:8080')  # mitmproxy not running\nclient = Client(transport=transport)\nclient.get('https://example.com')  # TransportError: Proxy error: [Errno 111] Connection refused\n\n# after\ntransport = ProxyTransport('http://127.0.0.1:8080')\nclient = Client(transport=transport)\ntry:\n    client.get('https://example.com')\nexcept TransportError as e:\n    raise RuntimeError(f'proxy unreachable: {e.__cause__}') from e","handlingStrategy":"retry","validationCode":"import socket\nfrom urllib.parse import urlparse\n\ndef proxy_reachable(proxy_url: str, timeout: float = 2.0) -> bool:\n    u = urlparse(proxy_url)\n    try:\n        with socket.create_connection((u.hostname, u.port or 80), timeout=timeout):\n            return True\n    except OSError:\n        return False\n\nif not proxy_reachable('http://127.0.0.1:8080'):\n    client = Client()  # bypass proxy instead of failing","typeGuard":null,"tryCatchPattern":"try:\n    resp = client.get(url)\nexcept TransportError as e:\n    cause = e.__cause__\n    if 'Proxy error' in str(e) and isinstance(cause, ConnectionError):\n        client = Client()  # retry once without the proxy transport\n        resp = client.get(url)\n    else:\n        raise","preventionTips":["Health-check the proxy URL at startup (TCP connect) before routing production traffic through it","Confirm the proxy scheme matches the actual proxy type (http vs socks5) and required extras are installed","Keep the chained cause (e.__cause__) in logs — the 'Proxy error:' wrapper alone hides the real failure"],"tags":["http","proxy","transport","network","python"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}