ERR wrong number of arguments

A command has too many or too few arguments.

Redis returns this error when a command has more or fewer arguments than it accepts. The message names the command in lowercase. For a subcommand, it shows both names joined by |, such as 'config|get'.

ERR wrong number of arguments for 'get' command

In client libraries

Client libraryException or error typeMessage
redis-py ResponseError wrong number of arguments for '<command>' command
Jedis JedisDataException ERR wrong number of arguments for '<command>' command
node-redis SimpleError ERR wrong number of arguments for '<command>' command
Lettuce
The async API wraps the exception in an ExecutionException (get()) or a CompletionException (join()).
RedisCommandExecutionException ERR wrong number of arguments for '<command>' command
go-redis redis.Error ERR wrong number of arguments for '<command>' command
ioredis ReplyError ERR wrong number of arguments for '<command>' command
StackExchange.Redis
NRedisStack uses StackExchange.Redis, so it raises the same exceptions. The sync and async APIs raise the same exceptions.
RedisServerException ERR wrong number of arguments for '<command>' command
Predis Predis\Response\ServerException ERR wrong number of arguments for '<command>' command
redis-rb Redis::CommandError ERR wrong number of arguments for '<command>' command (redis://<host>:<port>)
redis-rs
The sync and async APIs raise the same errors.
ErrorKind::Server(ServerErrorKind::ResponseError) ResponseError: wrong number of arguments for '<command>' command

Example

> GET
(error) ERR wrong number of arguments for 'get' command
> CONFIG GET
(error) ERR wrong number of arguments for 'config|get' command

How to fix it

  • An argument is missing, or there's one too many. Compare your command with the syntax on its command page, such as GET.
  • Your code passed an empty list. Commands such as DEL, MGET, and HSET need at least one key or field. When your code builds the arguments from a list that turns out to be empty, the command gets no keys at all. Check for an empty list before you send the command.
  • A value with spaces was split into several arguments. In redis-cli, GET my key sends two arguments, my and key. Put quotes around a value that contains spaces: GET "my key".
  • The command is auth, and you passed a username and a password. Servers older than Redis 6 accept only a password. Upgrade the server, or send the password alone.
RATE THIS PAGE
Back to top ↑