{"record":{"id":"1513a2a1d8067fc7","repo":"SeleniumHQ/selenium","slug":"service-args-must-be-a-sequence-1513a2","errorCode":null,"errorMessage":"service_args must be a sequence","messagePattern":"service_args must be a sequence","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/chromium/service.py","lineNumber":93,"sourceCode":"            port=port,\n            env=env,\n            log_output=self.log_output,\n            driver_path_env_key=driver_path_env_key,\n            **kwargs,\n        )\n\n    def command_line_args(self) -> list[str]:\n        return [f\"--port={self.port}\"] + self._service_args\n\n    @property\n    def service_args(self) -> Sequence[str]:\n        \"\"\"Returns the sequence of service arguments.\"\"\"\n        return self._service_args\n\n    @service_args.setter\n    def service_args(self, value: Sequence[str]):\n        if isinstance(value, str) or not isinstance(value, Sequence):\n            raise TypeError(\"service_args must be a sequence\")\n        self._service_args = list(value)\n","sourceCodeStart":75,"sourceCodeEnd":95,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/chromium/service.py#L75-L95","documentation":"The `service_args` setter on `chromium.service.ChromiumDriverService` (the shared base for Chrome/Edge) validates its input identically to the chrome-specific service: it rejects `str` and any non-Sequence type. It needs a list of separate flags to forward to the driver binary. This is the base class version that the chrome and edge services inherit.","triggerScenarios":"`Service(service_args=\"--verbose\")` for Edge or Chromium, `Service(service_args=\"--log-level=ALL --append-log\")`, or `service.service_args = 5`. Same shape as the chrome-specific error but raised from the chromium base.","commonSituations":"Edge or Chromium users hitting the same single-string habit. Copying a flag string from a shell command. Passing a generator expression.","solutions":["Pass a list of flags: `Service(service_args=[\"--verbose\", \"--log-level=ALL\"])`.","Split a combined string: `Service(service_args=shlex.split(flags))`.","Prefer structured logging config (e.g. `--readable-timestamp`) as discrete list items."],"exampleFix":"// before\nfrom selenium.webdriver.chromium.utils import ...  # or edge service\nsvc = Service(service_args=\"--verbose\")  # TypeError\n// after\nsvc = Service(service_args=[\"--verbose\"])","handlingStrategy":"type-guard","validationCode":"from collections.abc import Sequence\nflags = \"--verbose\"\nassert not isinstance(flags, str) and isinstance(flags, Sequence), \"pass a list of flags\"\nservice_args = list(flags)","typeGuard":"from collections.abc import Sequence\ndef is_valid_service_args(value) -> bool:\n    return not isinstance(value, str) and isinstance(value, Sequence)","tryCatchPattern":"try:\n    svc = Service(service_args=flags)\nexcept TypeError:\n    import shlex\n    svc = Service(service_args=shlex.split(flags) if isinstance(flags, str) else list(flags))","preventionTips":["Always pass a list of flags for Chromium/Edge services.","Use shlex.split() to normalize a shell-style flag string.","Type config as list[str] to catch mistakes statically."],"tags":["service-args","type-check","chromium","python"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}