Categories About Us Contact Us Become a Member

How to fix the Redis CROSSSLOT error

In a cluster, this means a single multi-key command touched keys that live on different slots. Forcing those keys into the same slot resolves it. Jump to your situation below or work through the methods in order.

By Neeraj Singh ~6 min Updated Jun 2026 87% found this helpful
Error message
CROSSSLOT Keys in request don't hash to the same slot.
Summary

The Redis CROSSSLOT Keys in request don't hash to the same slot error happens in a Redis Cluster when a single multi-key command (such as MGET, MSET, a transaction, or a Lua script) references keys that map to different hash slots. Cluster commands that operate on multiple keys require all of those keys to live in the same slot, because a single command cannot span nodes. The fix is to make the related keys hash to one slot using a hash tag: wrap the common part of the key in braces, for example {user100}:profile and {user100}:orders, so Redis hashes only the bracketed portion and places both keys together. Alternatively, split the operation into per-key commands, or group keys by slot. Designing keys with hash tags from the start avoids the error.

What this error means

In a cluster, each key hashes to one of 16384 slots, and each slot lives on one node. A multi-key command runs on a single node, so it requires every key it touches to be in the same slot. CROSSSLOT means the keys you passed are scattered across different slots.

Redis cannot run one command across nodes, so it refuses rather than silently splitting it. The cure is to make the related keys share a slot using a hash tag, which forces Redis to hash only the tagged part, or to break the work into separate commands that each touch one slot.

Common causes

A multi-key command referenced keys in different slots.
Related keys were not designed with hash tags.
A transaction or script spans multiple slots.
Keys grouped logically but not by slot.
Expert insight

“CROSSSLOT is a cluster rule: a single multi-key command has to stay on one node, so all its keys must share a slot. The clean fix is hash tags, you wrap the common part in braces, like {user100}:profile and {user100}:orders, and Redis hashes only that bit, so both keys land together and MGET, MSET, transactions, scripts all just work. If you cannot retag, split the operation into per-key commands. Honestly, designing keys with hash tags up front saves a lot of pain.”

How to fix it

Method 1

Use hash tags to co-locate keys

1Wrap the shared part of related keys in braces so only it is hashed:
{user100}:profile
{user100}:orders
2Both keys now map to the same slot.
3Multi-key commands across them then succeed.
Method 2

Split into per-key operations

1If you cannot retag, replace the multi-key command with separate single-key commands.
2Use pipelining to keep it efficient.
3Each command then touches one slot.
Method 3

Group keys by slot

1Batch multi-key operations so each batch contains keys from one slot only.
2Compute the slot with CLUSTER KEYSLOT key if needed.
3Run one batch per slot.
Method 4

Design keys with hash tags upfront

1When modelling keys, put the entity id in a hash tag so its related keys co-locate.
2This prevents CROSSSLOT by design.
3Apply it consistently across the codebase.

CROSSSLOT means a multi-key command spanned different cluster slots. Use a hash tag, wrap the shared part of related keys in braces like {user100}, so they hash to the same slot and multi-key commands work. Otherwise split the operation into per-key commands grouped by slot.

Frequently asked questions

What does the Redis CROSSSLOT error mean?
In a cluster it means a single multi-key command, such as MGET, MSET, a transaction or a script, referenced keys that hash to different slots. Such a command must operate on keys in one slot.
How do I fix it?
Use a hash tag to force related keys into the same slot, for example {user100}:profile and {user100}:orders. Alternatively split the multi-key command into per-key commands grouped by slot.
What is a hash tag?
A hash tag is a part of the key wrapped in braces, like {user100}. Redis hashes only the bracketed portion, so all keys sharing that tag map to the same slot and node.
Why must keys share a slot?
A multi-key command runs on a single node, and each slot lives on one node. If the keys are in different slots they are on different nodes, which one command cannot span, so Redis returns CROSSSLOT.
Does this happen on a single instance?
No. CROSSSLOT is specific to Redis Cluster, where the keyspace is sharded into slots. A standalone instance has no slots, so multi-key commands work across any keys.
How do I find a key's slot?
Run CLUSTER KEYSLOT key to see which of the 16384 slots a key maps to. Keys sharing a hash tag return the same slot, confirming they will co-locate.

Still not working?

If keys with the same hash tag still report CROSSSLOT, the braces may be malformed (an empty {} or text outside a single tag pair changes hashing); verify with CLUSTER KEYSLOT that both keys return the same slot number. You can also submit your error to us for a tailored fix.

Was this fix helpful? Thanks for your feedback!