{"id":"3c1303db54e9934a","repo":"redis/redis-py","slug":"client-list-type-must-be-one-of-client-types-r","errorCode":null,"errorMessage":"CLIENT LIST _type must be one of {client_types!r}","messagePattern":"CLIENT LIST _type must be one of (.+?)","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":856,"sourceCode":"\n    def client_list(\n        self, _type: str | None = None, client_id: List[EncodableT] = [], **kwargs\n    ) -> list[dict[str, str]] | Awaitable[list[dict[str, str]]]:\n        \"\"\"\n        Returns a list of currently connected clients.\n        If type of client specified, only that type will be returned.\n\n        :param _type: optional. one of the client types (normal, master,\n         replica, pubsub)\n        :param client_id: optional. a list of client ids\n\n        For more information, see https://redis.io/commands/client-list\n        \"\"\"\n        args = []\n        if _type is not None:\n            client_types = (\"normal\", \"master\", \"replica\", \"pubsub\")\n            if str(_type).lower() not in client_types:\n                raise DataError(f\"CLIENT LIST _type must be one of {client_types!r}\")\n            args.append(b\"TYPE\")\n            args.append(_type)\n        if not isinstance(client_id, list):\n            raise DataError(\"client_id must be a list\")\n        if client_id:\n            args.append(b\"ID\")\n            args += client_id\n        return self.execute_command(\"CLIENT LIST\", *args, **kwargs)\n\n    @overload\n    def client_getname(self: SyncClientProtocol, **kwargs) -> bytes | str | None: ...\n\n    @overload\n    def client_getname(\n        self: AsyncClientProtocol, **kwargs\n    ) -> Awaitable[bytes | str | None]: ...\n\n    def client_getname(self, **kwargs) -> (bytes | str | None) | Awaitable[","sourceCodeStart":838,"sourceCodeEnd":874,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L838-L874","documentation":"Raised by client_list when the _type argument is not one of ('normal', 'master', 'replica', 'pubsub'). Note this tuple differs from client_kill's: 'slave' is NOT accepted here, only four values. The check is case-insensitive.","triggerScenarios":"Calling r.client_list(_type='slave') — valid for client_kill but rejected here. Passing _type='all', _type='worker', or any non-matching string.","commonSituations":"Developer uses the same _type vocabulary for both client_kill and client_list, not realizing client_list omits 'slave'. Legacy code migrated from client_kill calls. Using 'slave' for backward-compat with older Redis naming.","solutions":["Use 'replica' instead of 'slave' for client_list (both refer to the same connection class).","Restrict _type to one of: 'normal', 'master', 'replica', 'pubsub'.","Omit _type entirely to list all connected clients regardless of type."],"exampleFix":"# before\nr.client_list(_type='slave')\n# after\nr.client_list(_type='replica')","handlingStrategy":"validation","validationCode":"VALID_LIST_TYPES = {'normal', 'master', 'replica', 'pubsub'}\nif _type is not None and str(_type).lower() not in VALID_LIST_TYPES:\n    raise ValueError(f'Invalid client_list type: {_type}')","typeGuard":"def is_valid_list_type(t: str) -> bool:\n    return isinstance(t, str) and t.lower() in {'normal', 'master', 'replica', 'pubsub'}","tryCatchPattern":null,"preventionTips":["client_list and client_kill accept DIFFERENT _type vocabularies — 'slave' is kill-only.","Prefer 'replica' over 'slave' everywhere for forward compatibility."],"tags":["client-management","validation","dataerror"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}