Fix “ERR syntax error” when using the SISINTERCARD Command in Redis

If you’re getting an error that reads “ERR syntax error” when using the SINTERCARD command, it could be because your first argument is too low.

If this is the case, you can easily fix the issue by making sure that the first argument reflects the actual number of sets that you’re comparing.

Example of Error

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

SINTERCARD 2 set1 set2 set3

Result:

(error) ERR syntax error

In this case I provided three sets but the first argument is only 2.

Solution

To solve this issue, we simply need to ensure that our first argument reflects the actual number of keys that we’re comparing:

SINTERCARD 3 set1 set2 set3

Result:

(integer) 2

Here I changed the 2 to 3, and we got the desired result without error. The 3 reflects the actual number of sets that I passed.