SeleniumHQ/selenium · error · Exception

No proxy type is found for {value}

Error message

No proxy type is found for {value}

What it means

ProxyType.load resolves a proxy-type string (or dict with a 'string' key) to one of the defined ProxyType constants by uppercasing and matching. If no constant's 'string' matches, it raises a bare Exception (not ValueError). Valid strings: DIRECT, MANUAL, PAC, RESERVED1, AUTODETECT, SYSTEM, UNSPECIFIED.

Source

Thrown at py/selenium/webdriver/common/proxy.py:55

    DIRECT = ProxyTypeFactory.make(0, "DIRECT")  # Direct connection, no proxy (default on Windows).
    MANUAL = ProxyTypeFactory.make(1, "MANUAL")  # Manual proxy settings (e.g., for httpProxy).
    PAC = ProxyTypeFactory.make(2, "PAC")  # Proxy autoconfiguration from URL.
    RESERVED_1 = ProxyTypeFactory.make(3, "RESERVED1")  # Never used.
    AUTODETECT = ProxyTypeFactory.make(4, "AUTODETECT")  # Proxy autodetection (presumably with WPAD).
    SYSTEM = ProxyTypeFactory.make(5, "SYSTEM")  # Use system settings (default on Linux).
    UNSPECIFIED = ProxyTypeFactory.make(6, "UNSPECIFIED")  # Not initialized (for internal use).

    @classmethod
    def load(cls, value):
        if isinstance(value, dict) and "string" in value:
            value = value["string"]
        value = str(value).upper()
        for attr in dir(cls):
            attr_value = getattr(cls, attr)
            if isinstance(attr_value, dict) and "string" in attr_value and attr_value["string"] == value:
                return attr_value
        raise Exception(f"No proxy type is found for {value}")


class _ProxyTypeDescriptor:
    def __init__(self, name, p_type):
        self.name = name
        self.p_type = p_type

    def __get__(self, obj, cls):
        return getattr(obj, self.name)

    def __set__(self, obj, value):
        if self.name == "autodetect" and not isinstance(value, bool):
            raise ValueError("Autodetect proxy value needs to be a boolean")
        getattr(obj, "_verify_proxy_type_compatibility")(self.p_type)
        setattr(obj, "proxyType", self.p_type)
        setattr(obj, self.name, value)

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Use one of the defined types: DIRECT, MANUAL, PAC, AUTODETECT, SYSTEM (or UNSPECIFIED).
  2. For SOCKS proxies, set proxy_type to MANUAL and configure socksProxy/socksVersion.
  3. Catch the broad Exception (note: it is not a ValueError subclass) when loading user-supplied proxy types.

Example fix

# before
ProxyType.load('socks5')  # raises Exception

# after
from selenium.webdriver.common.proxy import ProxyType
p = Proxy()
p.proxy_type = ProxyType.MANUAL
p.socks_proxy = 'host:1080'
p.socks_version = 5
Defensive patterns

Strategy: validation

Validate before calling

from selenium.webdriver.common.proxy import ProxyType
ALLOWED = {getattr(ProxyType, a)['string'] for a in dir(ProxyType) if isinstance(getattr(ProxyType, a), dict) and 'string' in getattr(ProxyType, a)}
if str(value).upper() not in ALLOWED:
    raise ValueError(f'Unknown proxy type {value!r}; valid: {sorted(ALLOWED)}')

Type guard

from selenium.webdriver.common.proxy import ProxyType
def is_known_proxy_type(v) -> bool:
    s = v['string'] if isinstance(v, dict) and 'string' in v else str(v)
    return s.upper() in {getattr(ProxyType, a)['string'] for a in dir(ProxyType) if isinstance(getattr(ProxyType, a), dict) and 'string' in getattr(ProxyType, a)}

Try / catch

try:
    ProxyType.load(value)
except Exception:  # note: bare Exception, not ValueError
    proxy.proxy_type = ProxyType.MANUAL  # safe fallback

Prevention

When it happens

Trigger: Calling ProxyType.load('socks'), ProxyType.load('auto'), ProxyType.load(''), or Proxy(raw) with raw['proxyType'] set to an unrecognized value. The comparison is uppercase, so case alone is not the issue, but spelling is.

Common situations: Using 'socks'/'socks5' (not a Selenium proxy type — SOCKS is configured under MANUAL). Typo in config. Passing an empty or placeholder proxyType.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/61fd0d9b9784c844. Report an issue: GitHub.