nats-io/nats-server · error
Got an error loading %d index: %v
Error message
Got an error loading %d index: %v
What it means
While streaming log entries to a catching-up follower, loadEntry(index) returned an error other than ErrStoreEOF (e.g. store closed or corrupt WAL). The leader stops sending the current batch early rather than sending a gap; expected EOFs are silenced, so any log here is a genuine store read failure.
Source
Thrown at server/raft.go:3666
if !leader {
n.debug("Canceling catchup for %q, not leader anymore", peer)
return
}
n.debug("Running catchup for %q [%d:%d] to [%d:%d]", peer, ar.term, ar.index, pterm, last)
const maxOutstanding = 2 * 1024 * 1024 // 2MB for now.
next, total, om := uint64(0), 0, make(map[uint64]int)
sendNext := func() bool {
for total <= maxOutstanding {
next++
if next > last {
return true
}
ae, err := n.loadEntry(next)
if err != nil {
if err != ErrStoreEOF {
n.warn("Got an error loading %d index: %v", next, err)
}
return true
}
// Re-encode with the lterm if needed
if ae.lterm != term {
ae.lterm = term
if ae.buf, err = ae.encode(ae.buf[:0]); err != nil {
n.warn("Got an error re-encoding append entry: %v", err)
return true
}
}
// Update our tracking total.
om[next] = len(ae.buf)
total += len(ae.buf)
n.sendRPC(subj, reply, ae.buf)
}
return false
}View on GitHub (pinned to 3a66a489d2)
Solutions
- Check WAL/stream store health on the leader for read errors
- If the store is corrupted, the leader should step down so a healthy node serves catchup
- Restart the leader process if the underlying file handles are stale
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at server/raft.go:3666 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/6caeb2ac0a0366da.
Report an issue: GitHub.