# MongoServerError: Balancer failed: chunk move failed with error 'ShardNotFound: no config server primary available for shard'

- **ID:** `mongodb/sharded-cluster-balancer-stuck`
- **Domain:** mongodb
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The config server replica set has no primary due to network issues or election failure, preventing the balancer from moving chunks.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| mongodb-4.2 | active | — | — |
| mongodb-4.4 | active | — | — |
| mongodb-5.0 | active | — | — |
| mongodb-6.0 | active | — | — |
| mongodb-7.0 | active | — | — |

## Workarounds

1. **Check config server replica set status: rs.status(). If no primary, force an election: rs.stepDown() on the current secondary that should be primary. Or restart the config server nodes one by one.** (80% success)
   ```
   Check config server replica set status: rs.status(). If no primary, force an election: rs.stepDown() on the current secondary that should be primary. Or restart the config server nodes one by one.
   ```
2. **Temporarily disable the balancer to reduce load: sh.stopBalancer(). Then fix the config server issue, then re-enable: sh.startBalancer().** (85% success)
   ```
   Temporarily disable the balancer to reduce load: sh.stopBalancer(). Then fix the config server issue, then re-enable: sh.startBalancer().
   ```
3. **Ensure config server nodes have sufficient resources and network connectivity. Check logs for election issues. Example: grep 'election' /var/log/mongodb/mongod.log** (75% success)
   ```
   Ensure config server nodes have sufficient resources and network connectivity. Check logs for election issues. Example: grep 'election' /var/log/mongodb/mongod.log
   ```

## Dead Ends

- **** — The error indicates no config server primary; manual moves also require a healthy config server. (90% fail)
- **** — The balancer cannot start if the config server has no primary; this only re-enables the scheduler. (80% fail)
- **** — This causes data loss and does not fix the underlying config server issue. (100% fail)
