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.
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.
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 mykeyFor 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.
ERR Unbalanced XREAD list of streams
How to fix "ERR Unbalanced XREAD list" in Redis
ERR syntax error
How to fix "ERR syntax error" in Redis
ConnectionError: Error while reading from socket
ConnectionError: Error while reading from socket in redis-py
Command timed out
How to fix 'Command timed out' in ioredis
ERR DISCARD without MULTI
How to fix "ERR DISCARD without MULTI" in Redis