{"record":{"id":"6caeb2ac0a0366da","repo":"nats-io/nats-server","slug":"got-an-error-loading-d-index-v","errorCode":null,"errorMessage":"Got an error loading %d index: %v","messagePattern":"Got an error loading (.+?) index: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/raft.go","lineNumber":3666,"sourceCode":"\tif !leader {\n\t\tn.debug(\"Canceling catchup for %q, not leader anymore\", peer)\n\t\treturn\n\t}\n\tn.debug(\"Running catchup for %q [%d:%d] to [%d:%d]\", peer, ar.term, ar.index, pterm, last)\n\n\tconst maxOutstanding = 2 * 1024 * 1024 // 2MB for now.\n\tnext, total, om := uint64(0), 0, make(map[uint64]int)\n\n\tsendNext := func() bool {\n\t\tfor total <= maxOutstanding {\n\t\t\tnext++\n\t\t\tif next > last {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tae, err := n.loadEntry(next)\n\t\t\tif err != nil {\n\t\t\t\tif err != ErrStoreEOF {\n\t\t\t\t\tn.warn(\"Got an error loading %d index: %v\", next, err)\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t// Re-encode with the lterm if needed\n\t\t\tif ae.lterm != term {\n\t\t\t\tae.lterm = term\n\t\t\t\tif ae.buf, err = ae.encode(ae.buf[:0]); err != nil {\n\t\t\t\t\tn.warn(\"Got an error re-encoding append entry: %v\", err)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Update our tracking total.\n\t\t\tom[next] = len(ae.buf)\n\t\t\ttotal += len(ae.buf)\n\t\t\tn.sendRPC(subj, reply, ae.buf)\n\t\t}\n\t\treturn false\n\t}","sourceCodeStart":3648,"sourceCodeEnd":3684,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/raft.go#L3648-L3684","documentation":"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.","triggerScenarios":"Thrown at server/raft.go:3666 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}