NOREPLICAS
RedisERRORReplicationHIGH confidence

Not enough good replicas to write

Production Risk

Medium. While it prevents writes from being confirmed, it correctly signals a potential data durability issue.

What this means

This error occurs when using the WAIT command for synchronous replication. It indicates that the number of replicas acknowledging the write within the given timeout is less than the number of replicas requested.

Why it happens
  1. 1Network latency is preventing replicas from acknowledging the writes in time.
  2. 2One or more replica instances are down or have crashed.
  3. 3The timeout specified in the WAIT command is too short for the network environment.
How to reproduce

A primary with 2 replicas is asked to wait for 3 replicas to acknowledge a write.

trigger — this will error
trigger — this will error
SET mykey "value"
WAIT 3 1000

expected output

(integer) 2

Fix 1

Adjust the number of replicas to wait for

WHEN When you can tolerate acknowledgements from fewer replicas

Adjust the number of replicas to wait for
# Wait for at least 1 replica within 500ms
WAIT 1 500

Why this works

Lowering the replica count in the WAIT command to a realistic number based on your available replicas will make it succeed.

Fix 2

Increase the timeout

WHEN When replicas are healthy but slow to respond

Increase the timeout
WAIT 2 2000 # Wait for 2 replicas for up to 2 seconds

Why this works

Giving the replicas more time to receive the writes from the primary and send back acknowledgements can resolve the issue if it's caused by network lag.

Fix 3

Fix the underlying replica issue

WHEN When replicas are offline or not syncing

Fix the underlying replica issue
# On primary, check replica status
INFO replication

Why this works

The `INFO replication` command provides details on connected replicas and their status. Use this to identify and fix any replicas that are down or lagging significantly.

What not to do

Set the number of replicas to 0 in every WAIT command

This effectively disables synchronous replication and removes any guarantee that the write has been propagated, defeating the purpose of using WAIT in the first place.

Sources
Official documentation ↗

Synchronous replication implementation

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Redis errors