ERR Number of keys can't be greater than number of args: EVAL/EVALSHA: numkeys exceeds argument count
RedisWhat does it mean?
When running a Lua script (EVAL/EVALSHA/FCALL), the specified number of keys (numkeys) is greater than the number of arguments actually passed to the command. Redis rejects the command because it cannot split the KEYS and ARGV arrays.
Why does it happen?
The EVAL syntax is 'EVAL script numkeys key [key ...] arg [arg ...]'. The numkeys value was miscalculated (set too high) or the expected keys were never added to the command. A common programming mistake.
How to fix it
Make numkeys exactly equal to the number of keys actually passed to the command. Use your client library's EVAL wrapper (which usually takes KEYS and ARGV as separate lists) so numkeys is computed automatically. When calling the script, split keys into KEYS and other parameters into ARGV correctly.
More from this engine
- ERR Background save already in progressBackground save already in progress
- ERR bit offset is not an integer or out of rangeBit offset is not an integer or out of range
- ERR Protocol error: invalid multibulk lengthProtocol error: invalid multibulk length
- ERR WATCH inside MULTI is not allowedWATCH inside MULTI is not allowed
- ERR WAIT cannot be used with replica instancesWAIT cannot be used with replica instances
- ERR Background append only file rewriting already in progressAOF rewrite already in progress
- IOERR error or timeout reading from target instanceMIGRATE: I/O error or timeout to target