{"record":{"id":"13f0d99073b92cf1","repo":"SeleniumHQ/selenium","slug":"no-proxy-list-must-contain-only-strings","errorCode":null,"errorMessage":"no_proxy list must contain only strings","messagePattern":"no_proxy list must contain only strings","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/proxy.py","lineNumber":211,"sourceCode":"        proxy_type = self.proxyType[\"string\"].lower()\n        result = {\"proxyType\": proxy_type}\n\n        if proxy_type == \"manual\":\n            if self.httpProxy:\n                result[\"httpProxy\"] = self.httpProxy\n            if self.sslProxy:\n                result[\"sslProxy\"] = self.sslProxy\n            if self.socksProxy:\n                result[\"socksProxy\"] = self.socksProxy\n            if self.socksVersion is not None:\n                result[\"socksVersion\"] = self.socksVersion\n            if self.noProxy:\n                # Convert comma-separated string to list\n                if isinstance(self.noProxy, str):\n                    result[\"noProxy\"] = [host.strip() for host in self.noProxy.split(\",\") if host.strip()]\n                elif isinstance(self.noProxy, list):\n                    if not all(isinstance(h, str) for h in self.noProxy):\n                        raise TypeError(\"no_proxy list must contain only strings\")\n                    result[\"noProxy\"] = self.noProxy\n                else:\n                    raise TypeError(\"no_proxy must be a comma-separated string or a list of strings\")\n\n        elif proxy_type == \"pac\":\n            if self.proxyAutoconfigUrl:\n                result[\"proxyAutoconfigUrl\"] = self.proxyAutoconfigUrl\n\n        return result\n","sourceCodeStart":193,"sourceCodeEnd":221,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/proxy.py#L193-L221","documentation":"When converting proxy settings to BiDi format (to_bidi_dict), if noProxy is a list, every element must be a string. A list containing a non-string (int, None, dict) raises TypeError. This runs only when proxyType is 'manual'.","triggerScenarios":"Setting proxy.no_proxy = ['localhost', 8080] or proxy.no_proxy = [None, 'host'] then calling proxy.to_bidi_dict(). The list itself is accepted by the setter (MANUAL descriptor) but fails at BiDi conversion.","commonSituations":"Mixing ports into the bypass list as ints. Building the list from mixed-type config. Parsing a bypass string into tokens that include numeric ports.","solutions":["Ensure every element of the no_proxy list is a string: [str(h) for h in hosts].","Store full 'host:port' strings rather than separate ints."],"exampleFix":"# before\nproxy.no_proxy = ['localhost', 8080]  # int in list\nproxy.to_bidi_dict()  # raises TypeError\n\n# after\nproxy.no_proxy = ['localhost', '8080']\n# or normalize\nproxy.no_proxy = [str(h) for h in raw_hosts]","handlingStrategy":"validation","validationCode":"if isinstance(no_proxy, list):\n    no_proxy = [str(h) for h in no_proxy]\nproxy.no_proxy = no_proxy","typeGuard":"def is_str_list(v) -> bool:\n    return isinstance(v, list) and all(isinstance(h, str) for h in v)","tryCatchPattern":"try:\n    proxy.to_bidi_dict()\nexcept TypeError:\n    proxy.no_proxy = [str(h) for h in proxy.no_proxy]\n    proxy.to_bidi_dict()","preventionTips":["Store bypass entries as full 'host:port' strings.","Normalize list elements with str() before assigning."],"tags":["proxy","no-proxy","type-validation","bidi"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}