If you get an error that reads “WRONGTYPE Operation against a key holding the wrong kind of value” when setting a hash with a command like HSET
or HSETNX
, it’s probably because you’re trying to set a non-hash key that already exists. In other words, the key already exists, but it doesn’t contain a hash.
To fix this issue, be sure to use these commands on keys that either don’t already exist, or contain a hash.
Continue reading