Graphify-Labs/graphify · error · TransportError

Proxy error: {exc}

Error message

Proxy error: {exc}

What it means

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__.

Source

Thrown at worked/httpx/raw/transport.py:132


class ProxyTransport(BaseTransport):
    """
    Routes requests through an HTTP/HTTPS proxy.
    Wraps an inner transport and prepends proxy connection handling.
    """

    def __init__(self, proxy_url: str, *, inner: BaseTransport = None):
        self.proxy_url = proxy_url
        self._inner = inner or HTTPTransport()

    def handle_request(self, request: Request) -> Response:
        try:
            return self._inner.handle_request(request)
        except TransportError:
            raise
        except Exception as exc:
            raise TransportError(f"Proxy error: {exc}") from exc

    def close(self) -> None:
        self._inner.close()

View on GitHub (pinned to 7fe58b0b0f)

Solutions

  1. Verify the proxy is reachable and listening: curl -x <proxy_url> <target_url> from the same machine
  2. Check the proxy_url scheme/host/port for typos and confirm the protocol (http vs socks5) matches the actual proxy
  3. Inspect the chained cause (`except TransportError as e: print(e.__cause__)`) — it names the real failure (DNS, connection refused, SSL)
  4. If the proxy is optional, retry without ProxyTransport (plain HTTPTransport) or disable the proxy env vars for the request

Example fix

# before
transport = ProxyTransport('http://127.0.0.1:8080')  # mitmproxy not running
client = Client(transport=transport)
client.get('https://example.com')  # TransportError: Proxy error: [Errno 111] Connection refused

# after
transport = ProxyTransport('http://127.0.0.1:8080')
client = Client(transport=transport)
try:
    client.get('https://example.com')
except TransportError as e:
    raise RuntimeError(f'proxy unreachable: {e.__cause__}') from e
Defensive patterns

Strategy: retry

Validate before calling

import socket
from urllib.parse import urlparse

def proxy_reachable(proxy_url: str, timeout: float = 2.0) -> bool:
    u = urlparse(proxy_url)
    try:
        with socket.create_connection((u.hostname, u.port or 80), timeout=timeout):
            return True
    except OSError:
        return False

if not proxy_reachable('http://127.0.0.1:8080'):
    client = Client()  # bypass proxy instead of failing

Try / catch

try:
    resp = client.get(url)
except TransportError as e:
    cause = e.__cause__
    if 'Proxy error' in str(e) and isinstance(cause, ConnectionError):
        client = Client()  # retry once without the proxy transport
        resp = client.get(url)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14). Data as JSON: /api/errors/7aaf7d9a6e0c4620. Report an issue: GitHub.