{"record":{"id":"f642c112a978188a","repo":"SeleniumHQ/selenium","slug":"service-args-must-be-a-sequence-f642c1","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/wpewebkit/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/wpewebkit/service.py#L51-L71","documentation":"Raised by the service_args setter on wpewebkit.Service when the assigned value is a str or is not a collections.abc.Sequence. Identical validation to the webkitgtk Service class: strings are explicitly rejected to prevent passing a single argument string when a list of argument strings is expected.","triggerScenarios":"Assigning service.service_args = '--debug' (bare string) instead of ['--debug']; assigning a non-sequence type like int or dict; passing a space-delimited string of flags where the API expects a list.","commonSituations":"Configuring WPEWebDriver with extra command-line arguments; config-driven arg passing where the format is a string; migrating from a format that did not enforce types; copy-pasting CLI-style arguments.","solutions":["Pass a list or tuple of argument strings: service.service_args = ['--debug', '--port=1234'].","Split config strings before assignment: args = shlex.split(config_str).","Pass service_args in the constructor with the same list type."],"exampleFix":"// before\nservice.service_args = '--debug'\n// after\nservice.service_args = ['--debug']","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.","Split config strings with shlex.split() before assignment.","Use type hints to catch mismatches at the call site."],"tags":["selenium","wpewebkit","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"}