{"record":{"id":"34e7c444f0f13f17","repo":"SeleniumHQ/selenium","slug":"service-args-must-be-a-sequence-34e7c4","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/ie/service.py","lineNumber":95,"sourceCode":"            executable_path=executable_path,\n            port=port,\n            log_output=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":77,"sourceCodeEnd":97,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/ie/service.py#L77-L97","documentation":"Raised as TypeError by the InternetExplorerService.service_args setter when the value is a bare str or not a Sequence type. Identical to the Firefox service_args validation: a str is explicitly rejected (even though str is a Sequence) because it would be unpacked into individual characters. The value must be a list/tuple of string arguments.","triggerScenarios":"Passing service_args='--verbose' (single string) or service_args=123 (non-sequence) triggers the TypeError. Only list or tuple of strings is accepted.","commonSituations":"Developers passing a single CLI flag as a string. Passing a space-delimited string expecting automatic splitting.","solutions":["Wrap arguments in a list: service_args=['--verbose']","Use shlex.split() to split a string into a proper argument list","Pass a tuple of argument strings"],"exampleFix":"// before\nservice = Service(service_args='--log-level=TRACE')\n\n// after\nservice = Service(service_args=['--log-level=TRACE'])","handlingStrategy":"type-guard","validationCode":"args = '--log-level=TRACE'\nif isinstance(args, str):\n    args = [args]\nservice = Service(service_args=args)","typeGuard":"from collections.abc import Sequence\ndef is_arg_sequence(v) -> bool:\n    return not isinstance(v, str) and isinstance(v, Sequence)","tryCatchPattern":"try:\n    service.service_args = args\nexcept TypeError:\n    service.service_args = [args] if isinstance(args, str) else list(args)","preventionTips":["Always pass service_args as a list of strings","Never pass a bare string to service_args","Use shlex.split() for space-separated argument strings"],"tags":["ie","type-validation","service","arguments","sequence"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}