nats-io/nats-server · error

Got an error loading %d index: %v - will reset

Error message

Got an error loading %d index: %v - will reset

What it means

During applyCommit, the entry at 'index' was not in the pending-apply cache and loadEntry failed with a non-closed, non-EOF error (real store corruption or I/O failure). The node steps down if leader, resets the WAL, and cancels any catchup to recover from a consistent state.

Source

Thrown at server/raft.go:3872

	if index <= n.commit {
		n.debug("Ignoring apply commit for %d, already processed", index)
		return nil
	}

	if n.State() == Leader {
		delete(n.acks, index)
	}

	if index <= n.papplied {
		return nil
	}

	ae := n.pae[index]
	if ae == nil {
		var err error
		if ae, err = n.loadEntry(index); err != nil {
			if err != ErrStoreClosed && err != ErrStoreEOF {
				n.warn("Got an error loading %d index: %v - will reset", index, err)
				if n.State() == Leader {
					n.stepdownLocked(n.selectNextLeader())
				}
				// Reset and cancel any catchup.
				n.resetWAL()
				n.cancelCatchup()
			}
			return errEntryLoadFailed
		}
	} else {
		// Size it now, the buffer is cleared below.
		sz := n.entryStoreSize(ae)
		defer func() {
			if _, ok := n.pae[index]; ok {
				n.paeBytes -= sz
				delete(n.pae, index)
			}
		}()

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Investigate disk/store errors that caused loadEntry to fail
  2. The automatic resetWAL will re-sync from a leader; ensure at least one healthy peer exists
  3. If corruption recurs, snapshot and re-create the affected stream
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/raft.go:3872 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/320fed9e261f759d. Report an issue: GitHub.