# MongoServerError: OplogSlotNotAvailable: Cannot allocate oplog entry due to replication lag

- **ID:** `mongodb/oplog-slot-not-available`
- **Domain:** mongodb
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Secondary replication lag caused the primary to exhaust oplog slots, preventing new writes.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| MongoDB 6.0.5 | active | — | — |
| MongoDB 7.0.1 | active | — | — |

## Workarounds

1. **Temporarily reduce write load by throttling application writes or pausing batch jobs. Use db.setProfilingLevel(0) to disable profiling if enabled.** (75% success)
   ```
   Temporarily reduce write load by throttling application writes or pausing batch jobs. Use db.setProfilingLevel(0) to disable profiling if enabled.
   ```
2. **Increase secondary's priority or add more secondaries to distribute replication load. Use rs.add('host:port') to add a new secondary.** (85% success)
   ```
   Increase secondary's priority or add more secondaries to distribute replication load. Use rs.add('host:port') to add a new secondary.
   ```

## Dead Ends

- **** — Increasing oplog size doesn't fix the underlying replication delay; it only delays exhaustion. (60% fail)
- **** — Restarting the primary resets the oplog but doesn't resolve secondary lag; issue recurs quickly. (80% fail)
