Fix “WRONGTYPE Operation against a key holding the wrong kind of value” when using SMEMBERS in Redis

If you get an error that reads “WRONGTYPE Operation against a key holding the wrong kind of value” when using the SMEMBERS command in Redis, it’s probably because you’re passing a key with the wrong data type to the command.

The SMEMBERS command is a “set” command, and so it is intended to be used on keys that contain a set. If the key holds a different data type, you’ll likely get the above error.

Continue reading