How to fix ERR unknown command in Redis

RedisINTERMEDIATEMEDIUMUpdated Dec 26, 2025ยท 229 views

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
  1. Verify the command name is correct
  2. List all available commands on your server
  3. Check which Redis server you're connected to
  4. Update your client library if version-mismatched
redis โ€” error
# Incorrect
redis-cli SETT key value # SETT is not a command, should be SET
# Correct
redis-cli SET key value
redis-cli GET key
ERR 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

  1. Command name is misspelled or has incorrect syntax
  2. Client is using a Redis command that doesn't exist in the server's version
  3. Connected to Redis Sentinel (port 26379) instead of the actual Redis server
  4. Redis module (like RedisJSON or RedisSearch) is not installed but module-specific commands are being used
  5. Client library is issuing internal commands (like CLIENT SETINFO or HELLO) not supported by older server versions
  6. Custom Lua script contains invalid Redis command syntax

How to fix "ERR unknown command"

1Verify the command name is correct

Check the Redis command reference and ensure you're using the exact command name. Common mistakes include case sensitivity issues or typos:

bash
# Incorrect
redis-cli SETT key value      # SETT is not a command, should be SET

# Correct
redis-cli SET key value
redis-cli GET key

Command names in Redis are case-insensitive in redis-cli but must match exactly in client libraries.

2List all available commands on your server

Connect to your Redis server and use the COMMAND command to list all available commands:

bash
redis-cli COMMAND

This 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.

3Check which Redis server you're connected to

Verify you're connecting to the correct Redis instance:

bash
# Connect to your server
redis-cli -h your-host -p 6379

# Once connected, check server info
INFO server

This 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

4Update your client library if version-mismatched

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):

javascript
const redis = require('ioredis');
const client = new redis({
  host: 'localhost',
  port: 6379,
  disableClientInfo: true  // Prevents CLIENT SETINFO command
});

Ruby (redis-rb):

ruby
require 'redis'
redis = Redis.new(host: 'localhost', port: 6379, protocol: 2)  # Force RESP2

Python (redis-py < 5.0 for RESP2):

python
import redis
r = redis.Redis(host='localhost', port=6379, protocol=2)
5Install missing Redis modules if needed

If you're using module-specific commands (like JSON.SET or FT.CREATE), verify the module is installed:

bash
redis-cli INFO modules

If the module isn't listed, you need to install it. For example, to add RedisJSON:

bash
# Using Docker
docker run -d -p 6379:6379 redislabs/rejson:latest

# Or load the module when starting Redis
redis-server --loadmodule /path/to/rejson.so

For Managed Redis (AWS ElastiCache, Azure Cache, etc.), check if the module is available in your service tier. Some providers don't support all modules.

6Check your Lua script syntax if using EVAL

If using EVAL or EVALSHA commands with Lua scripts, ensure the script only calls valid Redis commands:

bash
redis-cli EVAL "return redis.call('GET', KEYS[1])" 1 mykey

Common 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

bash
# Incorrect
EVAL "redis.call(GET, key)" mykey

# Correct
EVAL "return redis.call('GET', KEYS[1])" 1 mykey

Advanced 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