{"id":"7f1e8b72f40bb827","repo":"redis/redis-py","slug":"invalid-args-in-command-args","errorCode":null,"errorMessage":"Invalid args in command: {args}","messagePattern":"Invalid args in command: (.+?)","errorType":"exception","errorClass":"RedisClusterException","httpStatus":null,"severity":"error","filePath":"redis/cluster.py","lineNumber":1465,"sourceCode":"            # The command contains the slot ID\n            return args[1]\n\n        # Get the keys in the command\n\n        # CLIENT TRACKING is a special case.\n        # It doesn't have any keys, it needs to be sent to the provided nodes\n        # By default it will be sent to all nodes.\n        if command.upper() == \"CLIENT TRACKING\":\n            return None\n\n        # EVAL and EVALSHA are common enough that it's wasteful to go to the\n        # redis server to parse the keys. Besides, there is a bug in redis<7.0\n        # where `self._get_command_keys()` fails anyway. So, we special case\n        # EVAL/EVALSHA.\n        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}\"","sourceCodeStart":1447,"sourceCodeEnd":1483,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/cluster.py#L1447-L1483","documentation":"Error \"Invalid args in command: {args}\" thrown in redis/redis-py.","triggerScenarios":"Thrown at redis/cluster.py:1465 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}