{"record":{"id":"c10d75b9600cc466","repo":"SeleniumHQ/selenium","slug":"specified-proxy-type-compatible-proxy-not-comp","errorCode":null,"errorMessage":"Specified proxy type ({compatible_proxy}) not compatible with current setting ({self.proxyType})","messagePattern":"Specified proxy type \\((.+?)\\) not compatible with current setting \\((.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/proxy.py","lineNumber":164,"sourceCode":"\n    @property\n    def proxy_type(self):\n        \"\"\"Returns proxy type as `ProxyType`.\"\"\"\n        return self.proxyType\n\n    @proxy_type.setter\n    def proxy_type(self, value) -> None:\n        \"\"\"Sets proxy type.\n\n        Args:\n            value: The proxy type.\n        \"\"\"\n        self._verify_proxy_type_compatibility(value)\n        self.proxyType = value\n\n    def _verify_proxy_type_compatibility(self, compatible_proxy):\n        if self.proxyType not in (ProxyType.UNSPECIFIED, compatible_proxy):\n            raise ValueError(\n                f\"Specified proxy type ({compatible_proxy}) not compatible with current setting ({self.proxyType})\"\n            )\n\n    def to_capabilities(self):\n        proxy_caps = {\"proxyType\": self.proxyType[\"string\"].lower()}\n        proxies = [\n            \"autodetect\",\n            \"httpProxy\",\n            \"proxyAutoconfigUrl\",\n            \"sslProxy\",\n            \"noProxy\",\n            \"socksProxy\",\n            \"socksUsername\",\n            \"socksPassword\",\n            \"socksVersion\",\n        ]\n        for proxy in proxies:\n            attr_value = getattr(self, proxy)","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/proxy.py#L146-L182","documentation":"A Proxy enforces that proxy settings stay self-consistent: each connection-related property (http_proxy, ssl_proxy, socks_*, no_proxy) is bound to a specific ProxyType (MANUAL or PAC). _verify_proxy_type_compatibility raises ValueError if the current proxyType is neither UNSPECIFIED nor the type that property requires. E.g. setting http_proxy while proxyType is PAC is rejected.","triggerScenarios":"Setting proxy.http_proxy = 'host' when proxyType is already PAC or AUTODETECT. Setting proxy.socks_proxy after setting proxyType = PAC. The order of assignment matters: once proxyType is committed to a non-MANUAL type, MANUAL-bound properties fail.","commonSituations":"Setting the proxy type first to the wrong value, then trying to add host details. Reusing a Proxy object across configurations. Mixing PAC and manual host settings.","solutions":["Set proxy_type = ProxyType.MANUAL before assigning http/ssl/socks/no_proxy properties.","For PAC, set proxy_autoconfig_url and proxy_type = ProxyType.PAC; do not set manual hosts.","If reusing a Proxy, reset proxy_type to UNSPECIFIED before reconfiguring."],"exampleFix":"# before\nproxy.proxy_type = ProxyType.PAC\nproxy.http_proxy = 'localhost:8080'  # PAC != MANUAL -> ValueError\n\n# after\nproxy.proxy_type = ProxyType.MANUAL\nproxy.http_proxy = 'localhost:8080'\n# or for PAC\nproxy.proxy_type = ProxyType.PAC\nproxy.proxy_autoconfig_url = 'http://host/proxy.pac'","handlingStrategy":"validation","validationCode":"from selenium.webdriver.common.proxy import ProxyType\n# Ensure MANUAL before setting host-type properties\nif proxy.proxyType not in (ProxyType.UNSPECIFIED, ProxyType.MANUAL):\n    proxy.proxy_type = ProxyType.MANUAL\nproxy.http_proxy = 'localhost:8080'","typeGuard":null,"tryCatchPattern":"try:\n    proxy.http_proxy = host\nexcept ValueError:\n    proxy.proxy_type = ProxyType.MANUAL\n    proxy.http_proxy = host","preventionTips":["Set the proxy type (MANUAL/PAC) before configuring host details.","Reset proxy_type to UNSPECIFIED when reusing a Proxy object.","Do not mix MANUAL hosts with PAC configuration."],"tags":["proxy","proxy-type","compatibility","validation"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}