nats-io/nats-server · error

%d append entries pending, %s

Error message

%d append entries pending, %s

What it means

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.

Source

Thrown at server/raft.go:5171

// cachePendingEntry saves append entries in memory for faster processing during applyCommit.
// Only save so many however to avoid memory bloat.
func (n *raft) cachePendingEntry(ae *appendEntry) {
	// Invalidate any cache entry at this index, we might have
	// stored it previously with a different value.
	if pae, ok := n.pae[n.pindex]; ok {
		n.paeBytes -= n.entryStoreSize(pae)
		delete(n.pae, n.pindex)
	}
	if l := uint64(len(n.pae)); l < paeDropThreshold && n.paeBytes < paeDropBytes {
		prev := n.paeBytes
		n.pae[n.pindex], l = ae, l+1
		n.paeBytes += n.entryStoreSize(ae)
		if l >= paeWarnThreshold && l%paeWarnModulo == 0 {
			n.warn("%d append entries pending", len(n.pae))
		} else if b := n.paeBytes; b >= paeWarnBytes {
			// Only log on transition past another paeWarnBytesModulo.
			if b/paeWarnBytesModulo != prev/paeWarnBytesModulo {
				n.warn("%d append entries pending, %s", l, friendlyBytes(b))
			}
		}
	}
}

// entryStoreSize returns the byte size of the given append entry as stored in our WAL.
// Lock should be held.
func (n *raft) entryStoreSize(ae *appendEntry) uint64 {
	if ae == nil || ae.buf == nil {
		return 0
	}
	if n.wtype == FileStorage {
		return fileStoreMsgSize(_EMPTY_, nil, ae.buf)
	}
	return memStoreMsgSize(_EMPTY_, nil, ae.buf)
}

// resetPendingEntries clears our append entry cache.

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Identify and unblock the slow applier (upper state machine, consumers)
  2. Monitor memory; the cache is capped so growth is bounded
  3. Reduce burst proposal load if sustained
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/raft.go:5171 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/8953370484a8871e. Report an issue: GitHub.