13436 — NotPrimaryOrSecondary

replicationconnectivity

The node is not primary or secondary — it cannot service requests

What is happening?

NotPrimaryOrSecondary is returned when a read or write is sent to a replica set member that is in a transient state such as STARTUP, STARTUP2, RECOVERING, ROLLBACK, or REMOVED. In these states, the member cannot service client operations because it has not yet completed its synchronisation process or is recovering from an inconsistent state.

Common causes

  1. Member is performing initial sync (STARTUP2 state)
  2. Member is recovering after an unclean shutdown
  3. Member is rolling back uncommitted writes after an election
  4. Member was removed from the replica set configuration
  5. Application connected directly to a member instead of using the replica set connection string

Diagnostic Steps