How to Fix MongoDB Error 278 (UnsatisfiableCommitQuorum)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mongodb error 278 when a replica set cannot meet your index commit quorum. To fix this UnsatisfiableCommitQuorum failure, match your quorum rule to healthy voting nodes. MongoDB returns code 278 with the name UnsatisfiableCommitQuorum during index creation on a cluster. The primary node checks if enough data-bearing nodes can build the index together. If too few nodes are online or eligible, the database stops the command right away. This check keeps your cluster from starting an index

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 278 when a replica set cannot meet your index commit quorum. To fix this UnsatisfiableCommitQuorum failure, match your quorum rule to healthy voting nodes.

MongoDB returns code 278 with the name UnsatisfiableCommitQuorum during index creation on a cluster. The primary node checks if enough data-bearing nodes can build the index together. If too few nodes are online or eligible, the database stops the command right away. This check keeps your cluster from starting an index build that can never finish.

Why mongodb error 278 happens in replica sets

A commit quorum tells the primary how many nodes must finish building an index. Until that count is reached, the primary will not mark the new index ready. You will hit mongodb error 278 when the requested node count exceeds available members. Several common cluster states trigger this specific failure in production systems.

First, a node might be down or unreachable due to a network split. If your quorum asks for all voting nodes, one offline member blocks the build. Second, your replica set might include members that do not hold data, like arbiters. Arbiters vote in elections, but they do not build indexes or store collection data. Counting an arbiter toward an index quorum causes an immediate UnsatisfiableCommitQuorum error.

Third, some replica set members might lack votes or have special index build settings. If a secondary cannot vote, it cannot help satisfy a voting quorum rule. Finally, running an index build with a quorum rule on a single node fails. Standalone servers and single-node sets cannot meet multi-node quorum targets.

How to diagnose and fix UnsatisfiableCommitQuorum safely

Start by checking the health and status of every member in your replica set. Look at how many data-bearing nodes are online, healthy, and able to vote. Compare that active count against the commit quorum requested by your index command. If a secondary node is down, bring it back online and let it sync. Once all expected nodes are healthy, run the index creation command again.

MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If your cluster layout changed, adjust the commit quorum value in your app script. Make sure the quorum matches the real number of voting, data-bearing members you run. Do not disable safety checks or drop quorum rules to zero in production. Doing so lets the primary use an index before secondaries finish building it. That state causes heavy read lag if a failover happens soon after.

Keep permissions tight while your team investigates and fixes this error. MongoDB grants access through role-based rules that apply down to the collection level. Use the built-in read role when checking collection stats, existing indexes, or database stats. The read role allows index and collection checks without granting write or drop rights. Only grant the readWrite role when an engineer or job must create the index. When inspecting live documents during a fix, make sure masking rewrites emails and card numbers.

Preventing quorum failures during schema changes

Plan index builds around your replica set size and maintenance windows. Before running schema scripts, check that no nodes are undergoing planned updates or restarts. Keep deployment scripts aware of whether they run against a full cluster or test node. A test script that works on a three-node set may fail on smaller staging clusters. Matching your quorum setting to each cluster topology stops code 278 before it starts.

Check MongoDB commands and documents on the wire

MongoDB roles and SCRAM login decide who opens a session. They do not check single commands or redact sensitive fields inside returned documents. With hoop.dev, you run an open-source proxy, a sidecar for your MongoDB, inline in the MongoDB wire protocol. On every command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Before a command runs, hoop.dev guardrails check its effect and refuse banned drops or writes with MongoDB error code 13, or hold risky commands for approval. On the way back, hoop.dev data masking rewrites sensitive fields in returned documents in memory, and every verdict is logged. See the open-source code on GitHub.

Frequently asked questions

What does MongoDB error code 278 mean?

Error 278 is named UnsatisfiableCommitQuorum in the official MongoDB error list. It means the replica set does not have enough eligible nodes to meet the index commit quorum.

Do arbiters count toward an index build commit quorum?

No, arbiters do not store collection data or build indexes in a replica set. Only data-bearing nodes that match your quorum rule can help satisfy the index build requirement.

Which MongoDB role is needed to check and create indexes?

The built-in read role lets you list indexes and check collection stats safely. To create or drop an index, a user needs the readWrite role on that database.

The query runs. The emails stay hidden.