SeleniumHQ/selenium · error · TypeError
Not allowed to specify a version when using an existing serv
Error message
Not allowed to specify a version when using an existing server path
What it means
Raised as TypeError by the Server constructor when both path and version are specified simultaneously. The path parameter points to an existing server .jar, making the version parameter (used to download a specific server version) contradictory and ambiguous. The constructor enforces mutual exclusivity at the top before any other field is set.
Source
Thrown at py/selenium/webdriver/remote/server.py:67
pin drivers with "--driver-configuration").
"""
DEFAULT_ARGS = ("--selenium-manager", "true", "--enable-managed-downloads", "true")
def __init__(
self,
host=None,
port=4444,
path=None,
version=None,
log_level="INFO",
env=None,
java_path=None,
startup_timeout=10,
args=None,
):
if path and version:
raise TypeError("Not allowed to specify a version when using an existing server path")
self.host = host
self.port = port
self.path = path
self.version = version
self.log_level = log_level
self.env = env
self.java_path = java_path
self.startup_timeout = startup_timeout
self.args = list(args) if args is not None else list(self.DEFAULT_ARGS)
self.process = None
@property
def startup_timeout(self):
return self._startup_timeout
@startup_timeout.setter
def startup_timeout(self, timeout):View on GitHub (pinned to aa36b38e69)
Solutions
- If using a local jar, remove the version parameter: Server(path='/path/to/selenium-server.jar')
- If downloading a specific version, remove the path parameter: Server(version='4.20.0')
- Ensure your configuration sets only one of the two, not both
Example fix
// before server = Server(path='/opt/selenium-server.jar', version='4.20.0') // after server = Server(path='/opt/selenium-server.jar')
Defensive patterns
Strategy: validation
Validate before calling
path = '/opt/selenium-server.jar'
version = '4.20.0'
if path and version:
version = None # path takes priority
server = Server(path=path, version=version) Try / catch
try:
server = Server(path=path, version=version)
except TypeError:
server = Server(path=path) # drop version when path is given Prevention
- Provide only one of path or version, never both
- Use path when you have a local jar, version when you want a download
- Clean up config files that may set both fields
When it happens
Trigger: Calling Server(path='/path/to/selenium-server.jar', version='4.20.0') triggers the TypeError. Providing both means the library cannot determine whether to use the local jar or download a specific version.
Common situations: Copy-pasting from examples that use version= and adding a path= override without removing version=. Config files that set both fields.
Related errors
- {__class__.__name__}.__init__() got an invalid port: '{port}
- {__class__.__name__}.__init__() got an invalid version: '{ve
- Invalid URL: ${aUrl}
- Do not know how to build driver: ${browser}; did you forget
- Must provide either 'remote_server_addr' or 'client_config'
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/6c28b627aef3dc56.
Report an issue: GitHub.