{"record":{"id":"61fd0d9b9784c844","repo":"SeleniumHQ/selenium","slug":"no-proxy-type-is-found-for-value","errorCode":null,"errorMessage":"No proxy type is found for {value}","messagePattern":"No proxy type is found for (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/proxy.py","lineNumber":55,"sourceCode":"\n    DIRECT = ProxyTypeFactory.make(0, \"DIRECT\")  # Direct connection, no proxy (default on Windows).\n    MANUAL = ProxyTypeFactory.make(1, \"MANUAL\")  # Manual proxy settings (e.g., for httpProxy).\n    PAC = ProxyTypeFactory.make(2, \"PAC\")  # Proxy autoconfiguration from URL.\n    RESERVED_1 = ProxyTypeFactory.make(3, \"RESERVED1\")  # Never used.\n    AUTODETECT = ProxyTypeFactory.make(4, \"AUTODETECT\")  # Proxy autodetection (presumably with WPAD).\n    SYSTEM = ProxyTypeFactory.make(5, \"SYSTEM\")  # Use system settings (default on Linux).\n    UNSPECIFIED = ProxyTypeFactory.make(6, \"UNSPECIFIED\")  # Not initialized (for internal use).\n\n    @classmethod\n    def load(cls, value):\n        if isinstance(value, dict) and \"string\" in value:\n            value = value[\"string\"]\n        value = str(value).upper()\n        for attr in dir(cls):\n            attr_value = getattr(cls, attr)\n            if isinstance(attr_value, dict) and \"string\" in attr_value and attr_value[\"string\"] == value:\n                return attr_value\n        raise Exception(f\"No proxy type is found for {value}\")\n\n\nclass _ProxyTypeDescriptor:\n    def __init__(self, name, p_type):\n        self.name = name\n        self.p_type = p_type\n\n    def __get__(self, obj, cls):\n        return getattr(obj, self.name)\n\n    def __set__(self, obj, value):\n        if self.name == \"autodetect\" and not isinstance(value, bool):\n            raise ValueError(\"Autodetect proxy value needs to be a boolean\")\n        getattr(obj, \"_verify_proxy_type_compatibility\")(self.p_type)\n        setattr(obj, \"proxyType\", self.p_type)\n        setattr(obj, self.name, value)\n\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/proxy.py#L37-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using 'socks'/'socks5' (not a Selenium proxy type — SOCKS is configured under MANUAL). Typo in config. Passing an empty or placeholder proxyType.","solutions":["Use one of the defined types: DIRECT, MANUAL, PAC, AUTODETECT, SYSTEM (or UNSPECIFIED).","For SOCKS proxies, set proxy_type to MANUAL and configure socksProxy/socksVersion.","Catch the broad Exception (note: it is not a ValueError subclass) when loading user-supplied proxy types."],"exampleFix":"# before\nProxyType.load('socks5')  # raises Exception\n\n# after\nfrom selenium.webdriver.common.proxy import ProxyType\np = Proxy()\np.proxy_type = ProxyType.MANUAL\np.socks_proxy = 'host:1080'\np.socks_version = 5","handlingStrategy":"validation","validationCode":"from selenium.webdriver.common.proxy import ProxyType\nALLOWED = {getattr(ProxyType, a)['string'] for a in dir(ProxyType) if isinstance(getattr(ProxyType, a), dict) and 'string' in getattr(ProxyType, a)}\nif str(value).upper() not in ALLOWED:\n    raise ValueError(f'Unknown proxy type {value!r}; valid: {sorted(ALLOWED)}')","typeGuard":"from selenium.webdriver.common.proxy import ProxyType\ndef is_known_proxy_type(v) -> bool:\n    s = v['string'] if isinstance(v, dict) and 'string' in v else str(v)\n    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)}","tryCatchPattern":"try:\n    ProxyType.load(value)\nexcept Exception:  # note: bare Exception, not ValueError\n    proxy.proxy_type = ProxyType.MANUAL  # safe fallback","preventionTips":["Use ProxyType constants directly instead of strings.","For SOCKS, use MANUAL + socksProxy/socksVersion, not a 'socks' type.","Catch broad Exception since load raises Exception, not ValueError."],"tags":["proxy","proxy-type","validation","enum"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}