{"id":"42f26e9272633b47","repo":"redis/redis-py","slug":"no-way-to-dispatch-this-command-to-redis-cluster-42f26e","errorCode":null,"errorMessage":"No way to dispatch this command to Redis Cluster. Missing key.\nYou can execute the command by specifying target nodes.\nCommand: {args}","messagePattern":"No way to dispatch this command to Redis Cluster\\. Missing key\\.\nYou can execute the command by specifying target nodes\\.\nCommand: (.+?)","errorType":"exception","errorClass":"RedisClusterException","httpStatus":null,"severity":"error","filePath":"redis/cluster.py","lineNumber":1480,"sourceCode":"        if command.upper() in (\"EVAL\", \"EVALSHA\"):\n            # command syntax: EVAL \"script body\" num_keys ...\n            if len(args) <= 2:\n                raise RedisClusterException(f\"Invalid args in command: {args}\")\n            num_actual_keys = int(args[2])\n            eval_keys = args[3 : 3 + num_actual_keys]\n            # if there are 0 keys, that means the script can be run on any node\n            # so we can just return a random slot\n            if len(eval_keys) == 0:\n                return random.randrange(0, REDIS_CLUSTER_HASH_SLOTS)\n            keys = eval_keys\n        else:\n            keys = self._get_command_keys(*args)\n            if keys is None or len(keys) == 0:\n                # FCALL can call a function with 0 keys, that means the function\n                #  can be run on any node so we can just return a random slot\n                if command.upper() in (\"FCALL\", \"FCALL_RO\"):\n                    return random.randrange(0, REDIS_CLUSTER_HASH_SLOTS)\n                raise RedisClusterException(\n                    \"No way to dispatch this command to Redis Cluster. \"\n                    \"Missing key.\\nYou can execute the command by specifying \"\n                    f\"target nodes.\\nCommand: {args}\"\n                )\n\n        # single key command\n        if len(keys) == 1:\n            return self.keyslot(keys[0])\n\n        # multi-key command; we need to make sure all keys are mapped to\n        # the same slot\n        slots = {self.keyslot(key) for key in keys}\n        if len(slots) != 1:\n            raise RedisClusterException(\n                f\"{command} - all keys must map to the same key slot\"\n            )\n\n        return slots.pop()","sourceCodeStart":1462,"sourceCodeEnd":1498,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/cluster.py#L1462-L1498","documentation":"Error \"No way to dispatch this command to Redis Cluster. Missing key.\nYou can execute the command by specifying target nodes.\nCommand: {args}\" thrown in redis/redis-py.","triggerScenarios":"Thrown at redis/cluster.py:1480 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}