How to fix ERR unknown command in Redis
Redis returned 'ERR unknown command' when you tried to execute a Redis command. This error means the server doesn't recognize the command you sent, usually due to a typo, version mismatch, connecting to the wrong Redis instance, or missing Redis modules.
Quick fix
Fixes ERR unknown command
# Incorrect
redis-cli SETT key value # SETT is not a command, should be SET
# Correct
redis-cli SET key value
redis-cli GET key- Verify the command name is correct
- List all available commands on your server
- Check which Redis server you're connected to
- Update your client library if version-mismatched
# Incorrectredis-cli SETT key value # SETT is not a command, should be SET# Correctredis-cli SET key valueredis-cli GET keyERR unknown command
What this error means
The 'ERR unknown command' error indicates that the Redis server received a command it doesn't recognize or support. This is a command-level error that typically points to a programming mistake rather than a transient network issue. Redis returns this error when the command name is misspelled, when the client's version is newer than the server and uses features not yet supported, or when connecting to a Redis instance that doesn't have required modules loaded.
Typical symptoms
- Redis CLI or application returns 'ERR unknown command' followed by the command name
- Specific commands fail (e.g., JSON.SET, FT.CREATE) while basic commands like GET/SET work
- Error occurs immediately after connecting and issuing commands
- Some commands work fine while others fail with the same error
- Issue appears after upgrading Redis client library but server version is older
Common causes
- Command name is misspelled or has incorrect syntax
- Client is using a Redis command that doesn't exist in the server's version
- Connected to Redis Sentinel (port 26379) instead of the actual Redis server
- Redis module (like RedisJSON or RedisSearch) is not installed but module-specific commands are being used
- Client library is issuing internal commands (like CLIENT SETINFO or HELLO) not supported by older server versions
- Custom Lua script contains invalid Redis command syntax
How to fix "ERR unknown command"
Check the Redis command reference and ensure you're using the exact command name. Common mistakes include case sensitivity issues or typos:
# Incorrect
redis-cli SETT key value # SETT is not a command, should be SET
# Correct
redis-cli SET key value
redis-cli GET keyCommand names in Redis are case-insensitive in redis-cli but must match exactly in client libraries.
Connect to your Redis server and use the COMMAND command to list all available commands:
redis-cli COMMANDThis returns a detailed list of all commands your Redis server supports. Search through this list to verify the command exists. If it doesn't appear, it's either not available in your server version or you're connected to the wrong instance.
Verify you're connecting to the correct Redis instance:
# Connect to your server
redis-cli -h your-host -p 6379
# Once connected, check server info
INFO serverThis shows you the Redis version and other details. Ensure you're not accidentally connecting to:
- Redis Sentinel (port 26379) instead of the actual Redis server
- A managed Redis service with limited commands
- An older Redis version that doesn't support your command
If you recently upgraded your Redis client library, it may be trying to use commands not available in your server version.
For example, ioredis and other clients may issue CLIENT SETINFO (Redis 7.2+), HELLO (Redis 6+), or other version-specific commands automatically.
Option 1: Upgrade your Redis server to match the client version.
Option 2: Disable version-specific features in your client:
Node.js (ioredis):
const redis = require('ioredis');
const client = new redis({
host: 'localhost',
port: 6379,
disableClientInfo: true // Prevents CLIENT SETINFO command
});Ruby (redis-rb):
require 'redis'
redis = Redis.new(host: 'localhost', port: 6379, protocol: 2) # Force RESP2Python (redis-py < 5.0 for RESP2):
import redis
r = redis.Redis(host='localhost', port=6379, protocol=2)If you're using module-specific commands (like JSON.SET or FT.CREATE), verify the module is installed:
redis-cli INFO modulesIf the module isn't listed, you need to install it. For example, to add RedisJSON:
# Using Docker
docker run -d -p 6379:6379 redislabs/rejson:latest
# Or load the module when starting Redis
redis-server --loadmodule /path/to/rejson.soFor Managed Redis (AWS ElastiCache, Azure Cache, etc.), check if the module is available in your service tier. Some providers don't support all modules.
If using EVAL or EVALSHA commands with Lua scripts, ensure the script only calls valid Redis commands:
redis-cli EVAL "return redis.call('GET', KEYS[1])" 1 mykeyCommon issues:
- Using incorrect command names inside Lua scripts
- Missing quotes around Lua string literals
- Forgetting to pass the key count and keys/args as separate arguments
# Incorrect
EVAL "redis.call(GET, key)" mykey
# Correct
EVAL "return redis.call('GET', KEYS[1])" 1 mykeyAdvanced notes
For managed Redis services (AWS ElastiCache, Azure Cache for Redis, Upstash, etc.), some commands are disabled for security and operational reasons. Check your provider's documentation for the list of available commands. In Redis Cluster mode, certain commands that access keys across slots (like KEYS, SCAN, MGET on non-uniform slots) may not be supported. Use COMMAND to verify cluster-supported commands. When using redis-py or other Python clients with RESP3 protocol (protocol=3), ensure your server supports RESP3; older servers will reject the HELLO command. Force RESP2 if needed with protocol=2. For development vs. production mismatches, use docker-compose or containers to ensure your local Redis version matches what's deployed.
Frequently asked questions
- What does "ERR unknown command" mean?
- The 'ERR unknown command' error indicates that the Redis server received a command it doesn't recognize or support. This is a command-level error that typically points to a programming mistake rather than a transient network issue. Redis returns this error when the command name is misspelled, when the client's version is newer than the server and uses features not yet supported, or when connecting to a Redis instance that doesn't have required modules loaded.
- How do I fix "ERR unknown command"?
- Redis returned 'ERR unknown command' when you tried to execute a Redis command. This error means the server doesn't recognize the command you sent, usually due to a typo, version mismatch, connecting to the wrong Redis instance, or missing Redis modules.
- What causes "ERR unknown command"?
- Command name is misspelled or has incorrect syntax Client is using a Redis command that doesn't exist in the server's version Connected to Redis Sentinel (port 26379) instead of the actual Redis server
- Is the "ERR unknown command" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐Redis Official Documentation
- ๐Redis Error Handling - Official Documentation(Official Docs)
- ๐COMMAND - Redis Documentation(Official Docs)