{"record":{"id":"70386aba9a640c05","repo":"SeleniumHQ/selenium","slug":"service-args-must-be-a-sequence-70386a","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/webkitgtk/service.py","lineNumber":69,"sourceCode":"            executable_path=executable_path,\n            port=port,\n            log_output=log_output,\n            env=env,\n            **kwargs,\n        )\n\n    def command_line_args(self) -> list[str]:\n        return [\"-p\", f\"{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":51,"sourceCodeEnd":71,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/webkitgtk/service.py#L51-L71","documentation":"Raised by the service_args setter on webkitgtk.Service when the assigned value is a str or is not a collections.abc.Sequence. Strings are explicitly rejected (even though str is technically a Sequence) to prevent accidentally passing a single argument string like '--verbose' when a list of individual argument strings is expected. The constructor accepts None or a Sequence and stores it as a list.","triggerScenarios":"Assigning service.service_args = '--debug' (a bare string) instead of ['--debug'] (a list); assigning an int, dict, or other non-sequence type; or assigning a single string argument where the API expects a list of separate flags.","commonSituations":"Configuring WebKitWebDriver with extra command-line arguments; migrating from a config format that stored args as a space-delimited string; copy-pasting CLI examples that show a string rather than a list; passing kwargs from a dictionary where the type was not validated upstream.","solutions":["Pass a list or tuple of argument strings: service.service_args = ['--debug', '--port=1234'].","If reading from a config string, split it first: args = config_str.split() or shlex.split(config_str).","Pass service_args in the Service constructor instead of the setter, with the same list type."],"exampleFix":"// before\nservice = Service()\nservice.service_args = '--debug --verbose'\n// after\nservice = Service()\nservice.service_args = ['--debug', '--verbose']","handlingStrategy":"type-guard","validationCode":"from collections.abc import Sequence\n\nif isinstance(value, str) or not isinstance(value, Sequence):\n    raise TypeError('service_args must be a sequence of strings')\nservice.service_args = list(value)","typeGuard":"from collections.abc import Sequence\n\ndef is_valid_service_args(value) -> bool:\n    return not isinstance(value, str) and isinstance(value, Sequence) and all(isinstance(a, str) for a in value)","tryCatchPattern":"null","preventionTips":["Always pass service_args as a list of strings: ['--flag', '--opt=value'].","If reading args from a config string, split it first with shlex.split().","Use type hints (Sequence[str]) on your own code to catch mismatches early."],"tags":["selenium","webkitgtk","service","type-error","service-args","python"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}