{"record":{"id":"e8b967ae81e02350","repo":"SeleniumHQ/selenium","slug":"service-args-must-be-a-sequence-e8b967","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/edge/service.py","lineNumber":81,"sourceCode":"        return args + [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        \"\"\"Sets the service arguments for the Edge driver.\n\n        Args:\n            value: A sequence of strings representing service arguments.\n\n        Raises:\n            TypeError: If value is not a sequence or is a string.\n        \"\"\"\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":63,"sourceCodeEnd":83,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/edge/service.py#L63-L83","documentation":"Raised by the EdgeService.service_args setter when the assigned value is a str or is not a collections.abc.Sequence. Strings are explicitly excluded even though str is technically a Sequence (to prevent a single '--flag' being split into characters). The setter requires an actual sequence of strings like a list or tuple.","triggerScenarios":"Assigning service.service_args = '--verbose' (a single string), service.service_args = 123, or passing service_args as a string to the Edge Service constructor path that routes through this setter. Note the constructor itself coerces via list(service_args or []) and would NOT trigger this, so the setter is the specific trigger.","commonSituations":"Porting code that used a single space-separated string for flags, or a config system that yields strings instead of lists. Assigning after construction rather than at construction time is the typical trigger.","solutions":["Pass flags as a list: service.service_args = ['--verbose', '--whitelisted-ips='].","If you have a space-separated string, split it first: service.service_args = s.split().","Prefer setting service_args at construction time via the constructor parameter."],"exampleFix":"# before\nservice.service_args = '--verbose --port=9515'  # -> TypeError\n\n# after\nservice.service_args = ['--verbose', '--whitelisted-ips=']","handlingStrategy":"type-guard","validationCode":"from collections.abc import Sequence\ndef normalize_service_args(v):\n    if isinstance(v, str) or not isinstance(v, Sequence):\n        raise TypeError('service_args must be a non-string sequence')\n    return list(v)","typeGuard":"def is_valid_service_args(v) -> bool:\n    from collections.abc import Sequence\n    return not isinstance(v, str) and isinstance(v, Sequence)","tryCatchPattern":"try:\n    service.service_args = raw\nexcept TypeError:\n    service.service_args = raw.split() if isinstance(raw, str) else list(raw)","preventionTips":["Always pass service_args as a list of strings.","Set service_args at construction time to avoid the setter.","Add a config normalizer that splits space-separated flag strings."],"tags":["edge","service","type-validation","typeerror","configuration"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}