{"record":{"id":"70bee49d2b922575","repo":"SeleniumHQ/selenium","slug":"must-provide-either-remote-server-addr-or-clien","errorCode":null,"errorMessage":"Must provide either 'remote_server_addr' or 'client_config'","messagePattern":"Must provide either 'remote_server_addr' or 'client_config'","errorType":"exception","errorClass":"WebDriverException","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/remote/remote_connection.py","lineNumber":328,"sourceCode":"        self,\n        remote_server_addr: str | None = None,\n        keep_alive: bool = True,\n        ignore_proxy: bool = False,\n        ignore_certificates: bool | None = False,\n        init_args_for_pool_manager: dict | None = None,\n        client_config: ClientConfig | None = None,\n    ):\n        if client_config:\n            self._client_config = client_config\n        elif remote_server_addr:\n            self._client_config = ClientConfig(\n                remote_server_addr=remote_server_addr,\n                keep_alive=keep_alive,\n                ignore_certificates=ignore_certificates,\n                init_args_for_pool_manager=init_args_for_pool_manager,\n            )\n        else:\n            raise WebDriverException(\"Must provide either 'remote_server_addr' or 'client_config'\")\n\n        # Keep backward compatibility for AppiumConnection - https://github.com/SeleniumHQ/selenium/issues/14694\n        RemoteConnection._timeout = self._client_config.timeout\n        RemoteConnection._ca_certs = self._client_config.ca_certs\n        RemoteConnection._client_config = self._client_config\n        RemoteConnection.extra_headers = self._client_config.extra_headers or RemoteConnection.extra_headers\n        RemoteConnection.user_agent = self._client_config.user_agent or RemoteConnection.user_agent\n\n        if remote_server_addr:\n            warnings.warn(\n                \"setting remote_server_addr in RemoteConnection() is deprecated, set in client_config instead\",\n                DeprecationWarning,\n                stacklevel=2,\n            )\n\n        if not keep_alive:\n            warnings.warn(\n                \"setting keep_alive in RemoteConnection() is deprecated, set in client_config instead\",","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/remote/remote_connection.py#L310-L346","documentation":"Raised as WebDriverException by the RemoteConnection constructor when neither remote_server_addr nor client_config is provided. The connection needs at least one to know where the remote WebDriver server lives. If client_config is given it is used directly; if remote_server_addr is given a ClientConfig is derived from it; if neither is present the constructor cannot proceed.","triggerScenarios":"Calling RemoteConnection() with no arguments, or passing both as None explicitly. Also when a caller constructs RemoteConnection with only optional kwargs that don't include either parameter.","commonSituations":"Refactoring code that previously had a default URL and removing it. Building RemoteConnection dynamically where the URL comes from an env var that is unset. Migration to ClientConfig API where the old remote_server_addr was removed without adding the new parameter.","solutions":["Provide remote_server_addr: RemoteConnection('http://localhost:4444')","Or provide a ClientConfig object: RemoteConnection(client_config=ClientConfig(remote_server_addr='http://localhost:4444'))","Check that environment variables or config values feeding the URL are set before constructing the connection"],"exampleFix":"// before\nconn = RemoteConnection()\n\n// after\nconn = RemoteConnection('http://localhost:4444')\n# or\nfrom selenium.webdriver.remote.client_config import ClientConfig\nconn = RemoteConnection(client_config=ClientConfig(remote_server_addr='http://localhost:4444'))","handlingStrategy":"validation","validationCode":"url = os.environ.get('REMOTE_URL')\nif not url:\n    raise ValueError('REMOTE_URL environment variable is not set')\nconn = RemoteConnection(url)","typeGuard":null,"tryCatchPattern":"try:\n    conn = RemoteConnection(remote_url)\nexcept WebDriverException:\n    conn = RemoteConnection('http://localhost:4444')  # fallback to default","preventionTips":["Always provide remote_server_addr or client_config explicitly","Validate that URL config values are non-empty before constructing RemoteConnection","Use ClientConfig for the modern non-deprecated API"],"tags":["remote","connection","configuration","required-argument"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}