{"id":"2ea1b368971f80ae","repo":"redis/redis-py","slug":"target-nodes-type-can-be-one-of-the-following-nod-2ea1b3","errorCode":null,"errorMessage":"target_nodes type can be one of the following: node_flag (PRIMARIES, REPLICAS, RANDOM, ALL_NODES),ClusterNode, list<ClusterNode>, or dict<any, ClusterNode>. The passed type is {type(target_nodes)}","messagePattern":"target_nodes type can be one of the following: node_flag \\(PRIMARIES, REPLICAS, RANDOM, ALL_NODES\\),ClusterNode, list<ClusterNode>, or dict<any, ClusterNode>\\. The passed type is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"redis/cluster.py","lineNumber":1527,"sourceCode":"        \"\"\"\n        return self.nodes_manager.connection_kwargs\n\n    def _is_nodes_flag(self, target_nodes):\n        return isinstance(target_nodes, str) and target_nodes in self.node_flags\n\n    def _parse_target_nodes(self, target_nodes):\n        if isinstance(target_nodes, list):\n            nodes = target_nodes\n        elif isinstance(target_nodes, ClusterNode):\n            # Supports passing a single ClusterNode as a variable\n            nodes = [target_nodes]\n        elif isinstance(target_nodes, dict):\n            # Supports dictionaries of the format {node_name: node}.\n            # It enables to execute commands with multi nodes as follows:\n            # rc.cluster_save_config(rc.get_primaries())\n            nodes = target_nodes.values()\n        else:\n            raise TypeError(\n                \"target_nodes type can be one of the following: \"\n                \"node_flag (PRIMARIES, REPLICAS, RANDOM, ALL_NODES),\"\n                \"ClusterNode, list<ClusterNode>, or dict<any, ClusterNode>. \"\n                f\"The passed type is {type(target_nodes)}\"\n            )\n        return nodes\n\n    def execute_command(self, *args, **kwargs):\n        return self._internal_execute_command(*args, **kwargs)\n\n    def _internal_execute_command(self, *args, **kwargs):\n        \"\"\"\n        Wrapper for ERRORS_ALLOW_RETRY error handling.\n\n        It will try the number of times specified by the retries property from\n        config option \"self.retry\" which defaults to 10 unless manually\n        configured.\n","sourceCodeStart":1509,"sourceCodeEnd":1545,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/cluster.py#L1509-L1545","documentation":"Error \"target_nodes type can be one of the following: node_flag (PRIMARIES, REPLICAS, RANDOM, ALL_NODES),ClusterNode, list<ClusterNode>, or dict<any, ClusterNode>. The passed type is {type(target_nodes)}\" thrown in redis/redis-py.","triggerScenarios":"Thrown at redis/cluster.py:1527 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}