Fix “ERR wrong number of arguments for ‘sintercard’ command” in Redis

If you’re getting an error that reads “ERR wrong number of arguments for ‘sintercard’ command” in Redis, it’s because you’re calling the SINTERCARD command with the wrong number of arguments.

To fix this issue, make sure you’re passing the correct number of arguments.

Example of Error

Here’s an example of code that produces the error:

SINTERCARD 2

Result:

(error) ERR wrong number of arguments for 'sintercard' command

In this case, I only passed one argument, but I should have passed at least two.

Solution

To fix the issue, simply pass the correct number of arguments.

Example:

SINTERCARD 2 set1 set2

Result:

(integer) 4

Here, I provided the correct number of arguments and we got the desired result without error.

The correct number of arguments will depend on how many keys you’re comparing, and whether or not you use the LIMIT argument. See the Redis documentation to check the latest specification for this command.