redis/redis-py · error · RedisError
{cmd_name.upper()} command doesn't exist in Redis commands
Error message
{cmd_name.upper()} command doesn't exist in Redis commands What it means
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.
Source
Thrown at redis/_parsers/commands.py:150
if len(args) < 2:
# The command has no keys in it
return None
cmd_name = args[0].lower()
if cmd_name not in self.commands:
# try to split the command name and to take only the main command,
# e.g. 'memory' for 'memory usage'
cmd_name_split = cmd_name.split()
cmd_name = cmd_name_split[0]
if cmd_name in self.commands:
# save the split command to args
args = cmd_name_split + list(args[1:])
else:
# We'll try to reinitialize the commands cache, if the engine
# version has changed, the commands may not be current
self.initialize(redis_conn)
if cmd_name not in self.commands:
raise RedisError(
f"{cmd_name.upper()} command doesn't exist in Redis commands"
)
command = self.commands.get(cmd_name)
if "movablekeys" in command["flags"]:
keys = self._get_moveable_keys(redis_conn, *args)
elif "pubsub" in command["flags"] or command["name"] == "pubsub":
keys = self._get_pubsub_keys(*args)
else:
if (
command["step_count"] == 0
and command["first_key_pos"] == 0
and command["last_key_pos"] == 0
):
is_subcmd = False
if "subcommands" in command:
subcmd_name = f"{cmd_name}|{args[1].lower()}"
for subcmd in command["subcommands"]:View on GitHub (pinned to da03cdc7e8)
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).
Example fix
// before
await rc.execute_command("FT.SEARCH", "idx", "foo") # module not loaded
// after
# load the module on each master, or use an image with RediSearch:
# redis-server --loadmodule /path/redisearch.so
await rc.execute_command("FT.SEARCH", "idx", "foo") Defensive patterns
Strategy: validation
Validate before calling
# Validate the command is known before issuing through the cluster client
import redis
def command_known(rc, name):
info = rc.command(name)
return bool(info)
# usage
if not command_known(rc, "MEMORY"):
raise ValueError("MEMORY not available on this cluster") Try / catch
try:
rc.execute_command("FOO.BAR", "k")
except redis.exceptions.RedisError as e:
if "command doesn't exist in Redis commands" in str(e):
# command unknown / module missing; do not retry blindly
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Subcommand {subcommand_name} not found in command {command_n
- Command {command_name} not found in commands
- Incorrect request policy type: {policy_type}
- Incorrect response policy type: {policy_type}
- The requested node does not exist in the cluster.
AI-assisted analysis of redis/redis-py@da03cdc7e8 (2026-08-04).
Data as JSON: /data/errors/cad792ceb8a076d9.json.
Report an issue: GitHub.