{"record":{"id":"6ffdac6d6ab7d9e5","repo":"SeleniumHQ/selenium","slug":"can-t-find-server-jar-located-at-path","errorCode":null,"errorMessage":"Can't find server .jar located at {path}","messagePattern":"Can't find server \\.jar located at (.+?)","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/remote/server.py","lineNumber":100,"sourceCode":"        return self._startup_timeout\n\n    @startup_timeout.setter\n    def startup_timeout(self, timeout):\n        self._startup_timeout = int(timeout)\n\n    @property\n    def status_url(self):\n        host = self.host if self.host is not None else \"localhost\"\n        return f\"http://{host}:{self.port}/status\"\n\n    @property\n    def path(self):\n        return self._path\n\n    @path.setter\n    def path(self, path):\n        if path and not os.path.exists(path):\n            raise OSError(f\"Can't find server .jar located at {path}\")\n        self._path = path\n\n    @property\n    def port(self):\n        return self._port\n\n    @port.setter\n    def port(self, port):\n        try:\n            port = int(port)\n        except ValueError:\n            raise TypeError(f\"{__class__.__name__}.__init__() got an invalid port: '{port}'\")\n        if not (0 <= port <= 65535):\n            raise ValueError(\"port must be 0-65535\")\n        self._port = port\n\n    @property\n    def version(self):","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/remote/server.py#L82-L118","documentation":"Raised as OSError by the Server.path setter when a path is provided but os.path.exists returns False. The setter validates existence immediately on assignment so the user discovers a wrong path at configuration time rather than at server start time.","triggerScenarios":"Calling Server(path='/nonexistent/selenium-server.jar') or server.path = '/wrong/path.jar' triggers the OSError. The path must point to an existing file before assignment.","commonSituations":"Typo in the jar path. Wrong working directory for relative paths. CI environments where the jar hasn't been downloaded yet. Paths from config that reference a location not present on the current machine.","solutions":["Verify the path exists before passing it: os.path.exists(path)","Use an absolute path with os.path.abspath or pathlib.Path.resolve()","Download the Selenium Grid jar first if it is not yet present"],"exampleFix":"// before\nserver = Server(path='selenium-server.jar')  # relative, wrong CWD\n\n// after\nimport os\njar = os.path.abspath('/opt/selenium/selenium-server.jar')\nserver = Server(path=jar)","handlingStrategy":"validation","validationCode":"import os\njar_path = '/opt/selenium-server.jar'\nif not os.path.exists(jar_path):\n    raise FileNotFoundError(f'Server jar not found: {jar_path}')\nserver = Server(path=jar_path)","typeGuard":"import os\ndef jar_exists(path: str) -> bool:\n    return bool(path) and os.path.exists(path)","tryCatchPattern":"try:\n    server = Server(path=jar_path)\nexcept OSError:\n    download_selenium_jar(jar_path)  # fetch then retry\n    server = Server(path=jar_path)","preventionTips":["Verify jar existence with os.path.exists before passing path","Use absolute paths to avoid CWD issues","Download the Selenium Grid jar as a prerequisite build step in CI"],"tags":["remote","server","filesystem","path-validation","os-error"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}