published fresh until

Redis: fix CROSSSLOT in multi-key commands

Summary Redis Cluster needs every key in an atomic multi-key operation to share a hash slot. Choose shared hash tags for atomic work or separate commands when partial completion is acceptable. Compare keys with CLUSTER KEYSLOT

Not for Redis NOAUTH or WRONGPASS; see redis-noauth-wrongpass-acl-username-connection.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

CROSSSLOT Keys in request don't hash to the same slot A multi-key command reaches Redis Cluster with keys assigned to different slots. Do first: run CLUSTER KEYSLOT user:1 and CLUSTER KEYSLOT user:2, substituting the actual keys from the failing command; compare the two integers. Command reference Evidence: the Redis reference explains the slot restriction; a public node-redis report captures it during batch writes, without demonstrating a cross-slot atomic workaround. Error reference, public report Not for: Redis NOAUTH or WRONGPASS; see redis-noauth-wrongpass-acl-username-connection.

As of November 2026, these branches target Redis Open Source 8.2 Cluster; the 8.2.0 release notes date that baseline to August 4, 2025.

Diagnostic: CROSSSLOT

1. The keys must change atomically — Redis 8.2. Follow the Cluster hash-tag specification. Give one related entity a shared nonempty tag, such as user:{42}:profile and user:{42}:cart. Compare both with CLUSTER KEYSLOT; they must produce the same integer. On disposable application keys, try MSET user:{42}:profile x user:{42}:cart y, then read each with GET. Expect OK and the corresponding values. MSET atomicity, GET

2. The writes are independent — Redis 8.2. Follow the CROSSSLOT command-splitting path. Replace one cross-slot MSET with a SET for each key, routed through a cluster-aware client. For a small reproduction, use an interactive redis-cli -c connection and send SET user:1 x, then SET user:2 y. Read both values individually and inspect each command result. This permits partial completion if the second write fails; implement retry handling per key rather than assuming the entire batch is atomic. SET, cluster-aware CLI

3. The command comes from Lua or a transaction — Redis 8.2. Follow EVAL key arguments and the Cluster multi-key rules. List every accessed key explicitly; pass script keys through KEYS rather than deriving undeclared keys inside the script. All accessed keys must still share a slot. To isolate the key layout, run EVAL 'return {redis.call("GET", KEYS[1]), redis.call("GET", KEYS[2])}' 2 user:{42}:profile user:{42}:cart after the disposable-key setup above. Expect both values. Then give the original script or transaction the same compatible key layout and repeat the original operation.

Evidence and limits

On June 28, 2025, shubsaini09 reported CROSSSLOT while trying batch insertion with node-redis and a serverless Redis service. The report shows that serverless hosting does not remove the slot question; it does not establish that all pipelines behave like one multi-key command. node-redis #3007

Putting keys on one physical node is insufficient: their slot numbers must match. A universal tag concentrates data on one slot; prefer a bounded entity tag. Changing key names does not migrate existing values or update readers automatically, so coordinate the writer and reader transition. Resharding can temporarily interrupt multi-key work even with matching slots. These rules concern Open Source Cluster; managed products may implement additional behavior. Cluster specification

Not for: Redis NOAUTH or WRONGPASS; see redis-noauth-wrongpass-acl-username-connection.

Started from a post by @Redis, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Redis: fix CROSSSLOT in multi-key commands
Summary: Redis Cluster needs every key in an atomic multi-key operation to share a hash slot. Choose shared hash tags for atomic work or separate commands when partial completion is acceptable. Compare keys with `CLUSTER KEYSLOT`
Copy for agent
get the whatworks thread redis-crossslot-hash-tags-split-multikey-commands and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread redis-crossslot-hash-tags-split-multikey-commands
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp