{"record":{"id":"c7f64ff08ee4ad8b","repo":"nats-io/nats-server","slug":"leader-falling-behind-stepping-down-pindex-d-c","errorCode":null,"errorMessage":"Leader falling behind, stepping down: pindex %d, commit %d, applied %d, WAL size %s","messagePattern":"Leader falling behind, stepping down: pindex (.+?), commit (.+?), applied (.+?), WAL size (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/raft.go","lineNumber":994,"sourceCode":"\treturn n.proposeLocked(term, data)\n}\n\nfunc (n *raft) proposeLocked(term uint64, data []byte) error {\n\t// Check state under lock, we might not be leader anymore.\n\tif state := n.State(); state != Leader || term != n.term {\n\t\tn.debug(\"Proposal ignored, not leader (state: %v, cterm: %d, term: %d)\", state, term, n.term)\n\t\treturn errNotLeader\n\t}\n\n\t// Error if we had a previous write error.\n\tif werr := n.werr; werr != nil {\n\t\treturn werr\n\t}\n\n\tif n.isLeaderOverrun() {\n\t\tvar state StreamState\n\t\tn.wal.FastState(&state)\n\t\tn.warn(\"Leader falling behind, stepping down: pindex %d, commit %d, applied %d, WAL size %s\", n.pindex, n.commit, n.applied, friendlyBytes(state.Bytes))\n\t\t// Stepdown without leader transfer, likely all replicas will be overrun, and we need time to recover.\n\t\tn.stepdownLocked(noLeader)\n\t\tn.overrunCount++\n\t\treturn errNotLeader\n\t}\n\tn.prop.push(newProposedEntry(newEntry(EntryNormal, data), _EMPTY_, n.term))\n\treturn nil\n}\n\n// ProposeMulti will propose multiple entries at once.\n// This should only be called on the leader.\nfunc (n *raft) ProposeMulti(term uint64, entries []*Entry) error {\n\tif n.tryFastPathProposeMulti(term, entries) {\n\t\treturn nil\n\t}\n\tn.Lock()\n\tdefer n.Unlock()\n\t// Check state under lock, we might not be leader anymore.","sourceCodeStart":976,"sourceCodeEnd":1012,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/raft.go#L976-L1012","documentation":"A warning logged by proposeLocked() when isLeaderOverrun() detects the leader's write-ahead log has grown beyond safe limits (pindex/commit/applied divergence, WAL size reported). The leader steps down so a peer with a healthier WAL can take over, protecting the group from unbounded log growth.","triggerScenarios":"Thrown at server/raft.go:994 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Investigate why apply/consume rate lags proposals (slow disk, WAL write errors)","Check n.werr and disk health for the raft WAL storage","Allow the new leader to catch up; monitor WAL size after failover","Scale consumers or increase snapshot compaction frequency"],"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"}