{"record":{"id":"902d10de015a8513","repo":"nats-io/nats-server","slug":"d-append-entries-pending","errorCode":null,"errorMessage":"%d append entries pending","messagePattern":"(.+?) append entries pending","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/raft.go","lineNumber":5167,"sourceCode":"\t}\n\treturn nil\n}\n\n// cachePendingEntry saves append entries in memory for faster processing during applyCommit.\n// Only save so many however to avoid memory bloat.\nfunc (n *raft) cachePendingEntry(ae *appendEntry) {\n\t// Invalidate any cache entry at this index, we might have\n\t// stored it previously with a different value.\n\tif pae, ok := n.pae[n.pindex]; ok {\n\t\tn.paeBytes -= n.entryStoreSize(pae)\n\t\tdelete(n.pae, n.pindex)\n\t}\n\tif l := uint64(len(n.pae)); l < paeDropThreshold && n.paeBytes < paeDropBytes {\n\t\tprev := n.paeBytes\n\t\tn.pae[n.pindex], l = ae, l+1\n\t\tn.paeBytes += n.entryStoreSize(ae)\n\t\tif l >= paeWarnThreshold && l%paeWarnModulo == 0 {\n\t\t\tn.warn(\"%d append entries pending\", len(n.pae))\n\t\t} else if b := n.paeBytes; b >= paeWarnBytes {\n\t\t\t// Only log on transition past another paeWarnBytesModulo.\n\t\t\tif b/paeWarnBytesModulo != prev/paeWarnBytesModulo {\n\t\t\t\tn.warn(\"%d append entries pending, %s\", l, friendlyBytes(b))\n\t\t\t}\n\t\t}\n\t}\n}\n\n// entryStoreSize returns the byte size of the given append entry as stored in our WAL.\n// Lock should be held.\nfunc (n *raft) entryStoreSize(ae *appendEntry) uint64 {\n\tif ae == nil || ae.buf == nil {\n\t\treturn 0\n\t}\n\tif n.wtype == FileStorage {\n\t\treturn fileStoreMsgSize(_EMPTY_, nil, ae.buf)\n\t}","sourceCodeStart":5149,"sourceCodeEnd":5185,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/raft.go#L5149-L5185","documentation":"Advisory: the count of append entries cached in memory for fast apply (n.pae) has reached paeWarnThreshold. Beyond this the cache stops growing to bound memory; it is a signal that commit/application throughput is lagging proposal intake, not an error.","triggerScenarios":"Thrown at server/raft.go:5167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check what is slowing the apply loop (consumers, downstream systems)","Scale the node or reduce proposal pressure if the warning persists","No correctness impact — entries beyond the cache are loaded from the WAL"],"exampleFix":null,"handlingStrategy":"validation","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"}