# MongoServerError: ShardNotFound: no config server primary available for shard

- **ID:** `mongodb/sharded-cluster-no-config-primary`
- **Domain:** mongodb
- **Category:** network_error
- **Error Code:** `70`
- **Verification:** ai_generated
- **Fix Rate:** 70%

## Root Cause

The config server replica set has no primary node due to network partition, election failure, or node crash.

## Version Compatibility

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

## Workarounds

1. **Check config server replica set status: rs.status() on the config server, then force re-election if necessary: rs.stepDown() on the current primary or rs.reconfig() to add a new member.** (75% success)
   ```
   Check config server replica set status: rs.status() on the config server, then force re-election if necessary: rs.stepDown() on the current primary or rs.reconfig() to add a new member.
   ```
2. **Temporarily route reads to secondary with readPreference=secondaryPreferred if writes are not critical: db.getMongo().setReadPref('secondaryPreferred')** (60% success)
   ```
   Temporarily route reads to secondary with readPreference=secondaryPreferred if writes are not critical: db.getMongo().setReadPref('secondaryPreferred')
   ```

## Dead Ends

- **** — The mongos is not the issue; the config server replica set needs repair. (90% fail)
- **** — Connection pool size does not affect config server primary availability. (95% fail)
