This error message is a bit mislead as well. The error is due to trying to re-apply the last/current oplog entry again.
After looking a bit more into this, I have found this sequence which caused the problem:
- Chained replication
- Failover with rollback
- Chained replica starts rollback while still apply with buffered oplog entries
Under these conditions it is race where this error occurs when the rollback happens during/before all the buffered oplog entries are applied.