How to Fix MongoDB Error 270 (RepairedReplicaSetNode)
You get mongodb error 270 when a replica set node starts after a disk repair. To fix this error, wipe the node data directory and run a full initial sync. The database engine labels this issue as RepairedReplicaSetNode in the server logs. It stops a repaired member from rejoining the cluster with missing or changed data. This safety check protects your healthy replica set members from silent data loss. What causes mongodb error 270 in a replica set A crash or bad disk sector can corrupt loca
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get mongodb error 270 when a replica set node starts after a disk repair. To fix this error, wipe the node data directory and run a full initial sync.
The database engine labels this issue as RepairedReplicaSetNode in the server logs. It stops a repaired member from rejoining the cluster with missing or changed data. This safety check protects your healthy replica set members from silent data loss.
What causes mongodb error 270 in a replica set
A crash or bad disk sector can corrupt local storage files on a database node. Admins sometimes run a local storage repair tool to salvage data from that broken disk. The repair process scans local files and drops any corrupt data blocks it finds. Because the repair tool deletes broken records, the node no longer matches the rest of the cluster.
When the repair finishes, the database marks the local storage state as repaired. If you start that node back up as part of the replica set, the engine halts. It throws error 270 and refuses to accept replication traffic or serve client reads. The engine knows that mixing repaired local files with normal replication logs causes split data states.
Local disk repairs are meant only for standalone servers with no healthy backups. In a replica set, you already have clean copies of the data on other nodes. Running a local repair on a replica set member is the wrong recovery path. Instead of salvaging broken local files, the cluster needs to copy fresh data from a healthy member.
How to diagnose and fix the failure safely
First, check your database server logs on the failing node to confirm the error code. Look for the RepairedReplicaSetNode message and code 270 during the node startup sequence. Before you touch the broken node, check the health of your remaining replica set members. Make sure you have a stable primary node and enough healthy secondaries to keep quorum.
Once you verify that the cluster is stable, stop the database service on the affected node. Delete the contents of the data directory on that specific machine so it starts clean. Check the underlying disk health first if a hardware fault caused the first crash. Putting fresh data onto a failing hard drive will only cause another outage later.
MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
After the data directory is empty, start the database service back up on the node. The empty member will rejoin the replica set and start a clean initial sync. It copies all collections and indexes from a healthy member until it catches up. Wait for the node state to return to a normal secondary status before moving on.
How to prevent unsafe repairs in production
Outages often get worse when engineers log in with broad host privileges during an incident. Keep day-to-day database access scoped to built-in roles like the read role for viewing data. MongoDB grants access through role-based rules that apply down to the collection level. The read role lets engineers check collection stats and list indexes without changing any data.
When admins need to modify data, the readWrite role grants insert and update actions. Neither database role gives someone shell access to run disk repair tools on the host. Restrict host-level login rights so operators follow standard resync workflows instead of running manual file repairs. You can also apply data masking so sensitive fields like emails and phone numbers get rewritten in query results.
Add command guardrails and field masking beside MongoDB
Collection roles and IP rules control who connects to MongoDB. Yet an active client or agent session can still run a pipeline that writes data or reads raw personal fields. In practice, hoop.dev sits inline in the wire protocol beside your database as a sidecar for your MongoDB. For every command an agent or human sends in production, hoop.dev decides to pass, mask, block, or escalate it for review.
Using hoop.dev MongoDB controls, guardrails refuse banned commands before they run or hold risky calls for approval, and data masking rewrites matched fields in returned documents in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for GDPR, HIPAA, and PCI DSS programs. View the project on GitHub.
Frequently asked questions
What does RepairedReplicaSetNode mean in MongoDB?
RepairedReplicaSetNode is the official name for error code 270 in the database engine. It means a replica set member went through a local disk repair and cannot rejoin normally.
Can I bypass error 270 without wiping the node data directory?
No, you should not try to force a repaired node back into an active replica set. The local repair process drops corrupt records, so you must wipe the data directory and resync.
When should I use a local repair instead of a replica set resync?
Only run a local repair when you have a standalone node or every replica member is corrupt. If even one healthy member exists, always copy clean data from that good node instead.
Related guides
In this post