# TRYAGAIN: Slot is rehashing, retry the command

> A multi-key command hit keys that are being moved between nodes; the cluster asks the client to retry, and the command can succeed then.

Source: https://sqlly.app/errors/redis/tryagain
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

- Error prefix: `TRYAGAIN`
- Category: Cluster and replication

Error message:

```text
TRYAGAIN Multiple keys request during rehashing of slot
```

## What it means

TRYAGAIN is a temporary refusal, sent only for multi-key commands or Lua scripts whose keys sit in a slot that is being resharded: the command would need keys this node no longer has, and the cluster will not run it half-done. Unlike MOVED or CLUSTERDOWN it does not say the slot map is wrong; it says try the same command again, because once the migration step passes, it will go through.

Clients that follow redirects retry as part of normal handling. By hand, the error shows up while redis-cli --cluster reshard is running against a busy multi-key workload.

## Common causes

- A resharding job moved the slot while a multi-key command referenced keys in it.
- A Lua script touched keys in a migrating slot and not all of them are local yet.
- Repeated or interrupted reshard attempts left the slot flagged MIGRATING between runs.

## How to fix it

1. Retry the same command; the window is usually short:

   ```sql
   MGET {u}:a {u}:b
   # (error) TRYAGAIN Multiple keys request during rehashing of slot
   # ... a moment later the same command succeeds
   ```
2. If it persists, check whether the slot is stuck migrating:

   ```sql
   redis-cli -p 7000 CLUSTER NODES | grep '\['
   # [12182->-...] shows an unfinished migration for slot 12182
   ```
3. Finish the job with the cluster tool, or roll the slot back with CLUSTER SETSLOT on both nodes:

## Reproduce it safely

The slot number for the key prefix comes from CLUSTER KEYSLOT '{u}'; the error only fires while keys of that slot are still being moved.

```sql
redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 0
redis-cli -p 7000 MSET {u}:a 1 {u}:b 2
redis-cli -p 7000 CLUSTER SETSLOT <slot-of-{u}> MIGRATING <node-id>
redis-cli -p 7000 MGET {u}:a {u}:b
# (error) TRYAGAIN Multiple keys request during rehashing of slot
redis-cli --cluster reshard 127.0.0.1:7000   # completing the job clears it
```

## How SQLly helps

SQLly prints TRYAGAIN verbatim and runs CLUSTER NODES and CLUSTER SLOTS from the same editor, so you can confirm a reshard is in flight instead of suspecting your client library.

## Questions

### Should I back off exponentially on TRYAGAIN?

A short retry is enough. The error only exists while that one slot is moving, and redirect-aware clients already retry it as part of normal handling.

### Why not just serve the keys the node still has?

Multi-key commands are atomic by contract. Running them over a subset would silently change what the command means.

## Related errors

- [`ASK`](https://sqlly.app/errors/redis/ask): The key is migrating to another node
- [`CROSSSLOT`](https://sqlly.app/errors/redis/crossslot): Multi-key command spans two slots
- [`SQLITE_BUSY`](https://sqlly.app/errors/sqlite/sqlite-busy): SQLite: database is locked

The code and message text are from the [Redis documentation and source code](https://redis.io/docs/latest/).
