nats-io/nats-server · error
Falling behind in health check, commit %d != applied %d
Error message
Falling behind in health check, commit %d != applied %d
What it means
isCurrent detected commit > applied and the gap did not shrink after polling for up to 10x1ms — the state machine is not consuming committed entries. The node is flagged not-current (hcbehind set), which affects health reporting and can trigger leader replacement.
Source
Thrown at server/raft.go:2196
if startDelta := n.commit - n.applied; startDelta > 0 {
for i := 0; i < 10; i++ { // 10ms, in 1ms increments
n.Unlock()
time.Sleep(time.Millisecond)
n.Lock()
if n.State() == Closed {
n.debug("Node closed during health check, returning not current")
return false
}
if n.commit-n.applied < startDelta {
// The gap is getting smaller, so we're making forward progress.
clearBehindState()
return true
}
}
}
n.hcbehind = true
n.warn("Falling behind in health check, commit %d != applied %d", n.commit, n.applied)
return false
}
// Current returns if we are the leader for our group or an up to date follower.
func (n *raft) Current() bool {
if n == nil {
return false
}
n.Lock()
defer n.Unlock()
return n.isCurrent(false)
}
// Healthy returns if we are the leader for our group and nearly up-to-date.
func (n *raft) Healthy() bool {
if n == nil {
return false
}View on GitHub (pinned to 3a66a489d2)
Solutions
- Profile what is blocking the apply loop (slow consumers, blocked callbacks, CPU starvation)
- Scale or tune the upper layer draining the apply queue
- Check for paused apply queues that were never resumed
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at server/raft.go:2196 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/930695c2bd5eb962.
Report an issue: GitHub.