{"record":{"id":"8953370484a8871e","repo":"nats-io/nats-server","slug":"d-append-entries-pending-s","errorCode":null,"errorMessage":"%d append entries pending, %s","messagePattern":"(.+?) append entries pending, (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/raft.go","lineNumber":5171,"sourceCode":"// 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}\n\treturn memStoreMsgSize(_EMPTY_, nil, ae.buf)\n}\n\n// resetPendingEntries clears our append entry cache.","sourceCodeStart":5153,"sourceCodeEnd":5189,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/raft.go#L5153-L5189","documentation":"Advisory: cached pending append entries (n.pae) exceed the warn threshold in count and/or total bytes (with byte total included in the log). Memory-bounding caps prevent further caching; apply throughput is behind proposal flow. Purely operational, no data risk.","triggerScenarios":"Thrown at server/raft.go:5171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Identify and unblock the slow applier (upper state machine, consumers)","Monitor memory; the cache is capped so growth is bounded","Reduce burst proposal load if sustained"],"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"}