Replica set configuration fails to parse

When I use mongosh to connect to my instance of mongod I see the following warning:

2022-08-16T18:37:48.856-04:00: Document(s) exist in 'system.replset', but started without --replSet. Database contents may appear inconsistent with the writes that were visible when this node was running as part of a replica set. Restart with --replSet unless you are doing maintenance and no other clients are connected. The TTL collection monitor will not start because of this. For more info see

When I start mongod with the --replSet rs0 argument to address the error it fails to start up with the following fatal error:

  "t": { "$date": "2022-08-19T10:31:13.968-04:00" },
  "s": "F",
  "c": "REPL",
  "id": 28545,
  "ctx": "initandlisten",
  "msg": "Locally stored replica set configuration does not parse; See for information on how to recover from this",
  "attr": {
    "error": {
      "code": 40415,
      "codeName": "Location40415",
      "errmsg": "member: { _id: 0, host: \"\", arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, tags: {}, slaveDelay: 0, votes: 1 } :: caused by :: BSON field 'MemberConfig.slaveDelay' is an unknown field."
    "config": {
      "_id": "rs0",
      "version": 1,
      "term": 10,
      "members": [{
        "_id": 0,
        "host": "",
        "arbiterOnly": false,
        "buildIndexes": true,
        "hidden": false,
        "priority": 1,
        "tags": {},
        "slaveDelay": 0,
        "votes": 1
      "protocolVersion": 1,
      "writeConcernMajorityJournalDefault": true,
      "settings": {
        "chainingAllowed": true,
        "heartbeatIntervalMillis": 2000,
        "heartbeatTimeoutSecs": 10,
        "electionTimeoutMillis": 10000,
        "catchUpTimeoutMillis": -1,
        "catchUpTakeoverDelayMillis": 30000,
        "getLastErrorModes": {},
        "getLastErrorDefaults": { "w": 1, "wtimeout": 0 },
        "replicaSetId": { "$oid": "603820afb35392a07c24e0a8" }

The linked documentation just redirects to rs.reconfig, which requires a configuration in order to run. I set up this replica set a long time ago so I’m not sure how to find its original configuration.

How can I fix this error so that I can start up mongod with a replica set again? Should I run rs.reconfig with the config printed in the error message (minus the slaveDelay it’s failing to parse)?

I think you may have got into the interesting situation where you have previously had a <5.0 replicaset configured at one stage, switched it back to a standalone and then upgraded to 5.0+

The local db needs to be removed to get rid of the warning when running in standalone, as well as if you decide to convert this back to a replica set.

Start mongod without authentication enabled and drop the local database.

You can take additional steps to protect your database while authentication is disabled if it is available to a wider network by binding only to localhost with an alternate port from the usual/default or you can temporarily grant __system role to your administrative user.

Restart with your usual settings.


Thanks, this fixed my issue.
When I restarted mongod after dropping local any command I ran in mongosh gave me the error MongoServerError: node is not in primary or recovering state. Based on this information I found I ran rs.initiate() to reinitialize the replicas and everything seems to be working again.

I could have been more clear there as to what state you’d be in after that.

If running without --replSet you’re back to a standalone instance.

If running with --replSet you’re back to an uninitialized replica.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.