{"id":"cad792ceb8a076d9","repo":"redis/redis-py","slug":"cmd-name-upper-command-doesn-t-exist-in-redis","errorCode":null,"errorMessage":"{cmd_name.upper()} command doesn't exist in Redis commands","messagePattern":"(.+?) command doesn't exist in Redis commands","errorType":"exception","errorClass":"RedisError","httpStatus":null,"severity":"error","filePath":"redis/_parsers/commands.py","lineNumber":150,"sourceCode":"        if len(args) < 2:\n            # The command has no keys in it\n            return None\n\n        cmd_name = args[0].lower()\n        if cmd_name not in self.commands:\n            # try to split the command name and to take only the main command,\n            # e.g. 'memory' for 'memory usage'\n            cmd_name_split = cmd_name.split()\n            cmd_name = cmd_name_split[0]\n            if cmd_name in self.commands:\n                # save the split command to args\n                args = cmd_name_split + list(args[1:])\n            else:\n                # We'll try to reinitialize the commands cache, if the engine\n                # version has changed, the commands may not be current\n                self.initialize(redis_conn)\n                if cmd_name not in self.commands:\n                    raise RedisError(\n                        f\"{cmd_name.upper()} command doesn't exist in Redis commands\"\n                    )\n\n        command = self.commands.get(cmd_name)\n        if \"movablekeys\" in command[\"flags\"]:\n            keys = self._get_moveable_keys(redis_conn, *args)\n        elif \"pubsub\" in command[\"flags\"] or command[\"name\"] == \"pubsub\":\n            keys = self._get_pubsub_keys(*args)\n        else:\n            if (\n                command[\"step_count\"] == 0\n                and command[\"first_key_pos\"] == 0\n                and command[\"last_key_pos\"] == 0\n            ):\n                is_subcmd = False\n                if \"subcommands\" in command:\n                    subcmd_name = f\"{cmd_name}|{args[1].lower()}\"\n                    for subcmd in command[\"subcommands\"]:","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/_parsers/commands.py#L132-L168","documentation":"Raised by the sync CommandsParser.get_keys() when, after splitting the command name (e.g. 'memory' from 'memory usage') and re-running COMMAND to refresh the cache, the command is still unknown. The cluster client uses get_keys() to compute the slot for a command, so an unknown command cannot be routed. The error is a plain RedisError and includes the upper-cased command name.","triggerScenarios":"Calling an unknown or misspelled command through RedisCluster.execute_command(); a command from a Redis module that is not loaded on the node that answered COMMAND; a command whose name the cluster client cannot split into a known root; passing a fully-qualified module command like 'ft.search' when the search module is absent.","commonSituations":"RedisStack module not loaded (RediSearch, RedisJSON, RedisBloom) but client issues a module command; typo in command name; targeting a Redis < the version that introduced the command; COMMAND was ACL-restricted so the cache came back incomplete.","solutions":["Verify the command exists on the server with 'redis-cli COMMAND INFO <name>'.","Ensure any required module (RediSearch/JSON/Bloom/Timeseries) is loaded on every cluster node.","Check the calling user has permissions to run COMMAND (ACL) so the parser cache is populated.","Spell the command exactly as Redis knows it (case-insensitive, but no extra spaces)."],"exampleFix":"// before\nawait rc.execute_command(\"FT.SEARCH\", \"idx\", \"foo\")  # module not loaded\n\n// after\n# load the module on each master, or use an image with RediSearch:\n#   redis-server --loadmodule /path/redisearch.so\nawait rc.execute_command(\"FT.SEARCH\", \"idx\", \"foo\")","handlingStrategy":"validation","validationCode":"# Validate the command is known before issuing through the cluster client\nimport redis\ndef command_known(rc, name):\n    info = rc.command(name)\n    return bool(info)\n# usage\nif not command_known(rc, \"MEMORY\"):\n    raise ValueError(\"MEMORY not available on this cluster\")","typeGuard":null,"tryCatchPattern":"try:\n    rc.execute_command(\"FOO.BAR\", \"k\")\nexcept redis.exceptions.RedisError as e:\n    if \"command doesn't exist in Redis commands\" in str(e):\n        # command unknown / module missing; do not retry blindly\n        raise","preventionTips":["Run 'redis-cli COMMAND INFO <name>' on every node before issuing new commands.","Load required modules (RediSearch/JSON/Bloom) on all masters.","Grant the ACL user permission to run COMMAND so the cache is complete.","Spell command names exactly; pass multi-word commands as root + subcommand."],"tags":["cluster","commands","routing","sync"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}