{"record":{"id":"f63e47a6fa8edb7a","repo":"SeleniumHQ/selenium","slug":"no-proxy-must-be-a-comma-separated-string-or-a-lis","errorCode":null,"errorMessage":"no_proxy must be a comma-separated string or a list of strings","messagePattern":"no_proxy must be a comma-separated string or a list of strings","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/proxy.py","lineNumber":214,"sourceCode":"        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":196,"sourceCodeEnd":221,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/proxy.py#L196-L221","documentation":"When converting proxy settings to BiDi format (to_bidi_dict), if noProxy is set but is neither a string nor a list, TypeError is raised. Only a comma-separated string or a list of strings is accepted. This runs only when proxyType is 'manual'.","triggerScenarios":"Setting proxy.no_proxy = 8080 (int), proxy.no_proxy = ('a','b') (tuple), proxy.no_proxy = {'host':1} (dict), then calling proxy.to_bidi_dict(). The MANUAL setter accepts any truthy value, so the error surfaces only at BiDi conversion.","commonSituations":"Assigning a tuple, set, or int to no_proxy. Storing a single host as a bare value. Using a frozenset from config.","solutions":["Set no_proxy to a comma-separated string ('localhost,example.com') or a list of strings.","Convert other iterables to a list: list(value)."],"exampleFix":"# before\nproxy.no_proxy = ('localhost', 'example.com')  # tuple\nproxy.to_bidi_dict()  # raises TypeError\n\n# after\nproxy.no_proxy = 'localhost,example.com'\n# or\nproxy.no_proxy = ['localhost', 'example.com']","handlingStrategy":"validation","validationCode":"if not isinstance(no_proxy, (str, list)):\n    no_proxy = list(no_proxy) if hasattr(no_proxy, '__iter__') else str(no_proxy)\nproxy.no_proxy = no_proxy","typeGuard":"def is_valid_no_proxy(v) -> bool:\n    return isinstance(v, (str, list))","tryCatchPattern":"try:\n    proxy.to_bidi_dict()\nexcept TypeError:\n    proxy.no_proxy = ','.join(proxy.no_proxy) if isinstance(proxy.no_proxy, (list, tuple, set)) else ''\n    proxy.to_bidi_dict()","preventionTips":["Use a comma-separated string or list of strings for no_proxy.","Convert tuples/sets to a list at the config boundary."],"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"}