189 — PrimarySteppedDown

replicationconnectivity

The primary stepped down during the operation

What is happening?

PrimarySteppedDown means the current primary resigned its role while the operation was in progress. This can happen during a planned step-down, a failover triggered by an election, or when the primary detects it cannot reach a majority of voting members. The driver should retry against the new primary.

Common causes

  1. Planned maintenance triggering rs.stepDown()
  2. Network partition causing the primary to lose majority
  3. Another member calling an election due to priority changes
  4. Atlas maintenance window performing a rolling restart

Source code references

ErrorCodes::PrimarySteppedDown found in 36 locations in the MongoDB server source.

Diagnostic Steps