{"record":{"id":"0c9f3a716a205839","repo":"nats-io/nats-server","slug":"could-not-load-d-from-wal-v-v","errorCode":null,"errorMessage":"Could not load %d from WAL [%+v]: %v","messagePattern":"Could not load (.+?) from WAL \\[%\\+v\\]: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/raft.go","lineNumber":592,"sourceCode":"\tif state.Msgs > 0 {\n\t\tn.debug(\"Replaying state of %d entries\", state.Msgs)\n\n\t\t// This process will queue up entries on our applied queue but prior to the upper\n\t\t// state machine running. So we will monitor how much we have queued and if we\n\t\t// reach a limit will pause the apply queue and resume inside of run() go routine.\n\t\tconst maxQsz = 32 * 1024 * 1024 // 32MB max\n\n\t\t// It looks like there are entries we have committed but not applied\n\t\t// yet. Replay them.\n\t\tfor index, qsz := state.FirstSeq, 0; index <= state.LastSeq; index++ {\n\t\t\tae, err := n.loadEntry(index)\n\t\t\t// The first entry in our WAL initializes state but must align with our snapshot if we had one.\n\t\t\t// Importantly, check this first, as we might need to truncate the WAL further than the index.\n\t\t\tif index == state.FirstSeq {\n\t\t\t\t// If the entry is missing, corrupt, or doesn't align with the snapshot, truncate the WAL.\n\t\t\t\tif err != nil || ae == nil || ae.pindex != index-1 || n.pindex != ae.pindex {\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tn.warn(\"Could not load %d from WAL [%+v]: %v\", index, state, err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tn.warn(\"Misaligned WAL, will truncate\")\n\t\t\t\t\t}\n\t\t\t\t\t// Truncate to the snapshot or beginning if there is none.\n\t\t\t\t\ttruncateAndErr(n.pindex)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tn.pterm, n.pindex = ae.pterm, ae.pindex\n\t\t\t\tif ae.commit > 0 && ae.commit > n.commit {\n\t\t\t\t\tn.commit = ae.commit\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tn.warn(\"Could not load %d from WAL [%+v]: %v\", index, state, err)\n\t\t\t\t// Truncate to the previous correct entry.\n\t\t\t\ttruncateAndErr(index - 1)\n\t\t\t\tbreak\n\t\t\t}","sourceCodeStart":574,"sourceCodeEnd":610,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/raft.go#L574-L610","documentation":"A warning logged during raft node WAL replay when loadEntry(index) fails for a committed-but-not-yet-applied entry identified by its index. It means the write-ahead log entry could not be read or decoded (missing/corrupt entry), so that entry is skipped during replay and upper-layer state may miss it.","triggerScenarios":"Thrown at server/raft.go:592 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error and entry details for WAL corruption","If the entry is essential, restore the raft WAL from backup or catch up from another peer","Consider triggering a snapshot so the WAL range with the gap is no longer needed","Check disk health for the JetStream/raft storage directory"],"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"}