{"record":{"id":"320fed9e261f759d","repo":"nats-io/nats-server","slug":"got-an-error-loading-d-index-v-will-reset","errorCode":null,"errorMessage":"Got an error loading %d index: %v - will reset","messagePattern":"Got an error loading (.+?) index: (.+?) - will reset","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/raft.go","lineNumber":3872,"sourceCode":"\tif index <= n.commit {\n\t\tn.debug(\"Ignoring apply commit for %d, already processed\", index)\n\t\treturn nil\n\t}\n\n\tif n.State() == Leader {\n\t\tdelete(n.acks, index)\n\t}\n\n\tif index <= n.papplied {\n\t\treturn nil\n\t}\n\n\tae := n.pae[index]\n\tif ae == nil {\n\t\tvar err error\n\t\tif ae, err = n.loadEntry(index); err != nil {\n\t\t\tif err != ErrStoreClosed && err != ErrStoreEOF {\n\t\t\t\tn.warn(\"Got an error loading %d index: %v - will reset\", index, err)\n\t\t\t\tif n.State() == Leader {\n\t\t\t\t\tn.stepdownLocked(n.selectNextLeader())\n\t\t\t\t}\n\t\t\t\t// Reset and cancel any catchup.\n\t\t\t\tn.resetWAL()\n\t\t\t\tn.cancelCatchup()\n\t\t\t}\n\t\t\treturn errEntryLoadFailed\n\t\t}\n\t} else {\n\t\t// Size it now, the buffer is cleared below.\n\t\tsz := n.entryStoreSize(ae)\n\t\tdefer func() {\n\t\t\tif _, ok := n.pae[index]; ok {\n\t\t\t\tn.paeBytes -= sz\n\t\t\t\tdelete(n.pae, index)\n\t\t\t}\n\t\t}()","sourceCodeStart":3854,"sourceCodeEnd":3890,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/raft.go#L3854-L3890","documentation":"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.","triggerScenarios":"Thrown at server/raft.go:3872 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Investigate disk/store errors that caused loadEntry to fail","The automatic resetWAL will re-sync from a leader; ensure at least one healthy peer exists","If corruption recurs, snapshot and re-create the affected stream"],"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-08T15:18:49.778Z"}