nats-io/nats-server · error

Not requesting votes for %q, could not persist term and vote

Error message

Not requesting votes for %q, could not persist term and vote: %v

What it means

A candidate could not durably persist its self-vote before campaigning (writeTermVote failed), so it resets its vote to noVote and abandons this vote-request round. This prevents the unsafe case of voting for itself, restarting, and voting for another node in the same term.

Source

Thrown at server/raft.go:5694

		n.error("Received malformed vote request for %q", n.group)
		return
	}
	n.reqs.push(vr)
}

func (n *raft) requestVote() {
	n.Lock()
	if n.State() != Candidate {
		n.Unlock()
		return
	}
	n.vote = n.id
	if err := n.writeTermVote(); err != nil {
		// Make sure that our self-vote is persisted durably before campaigning, otherwise
		// we could vote for someone else in the same term after a restart.
		n.vote = noVote
		n.Unlock()
		n.warn("Not requesting votes for %q, could not persist term and vote: %v", n.group, err)
		return
	}
	vr := voteRequest{n.term, n.pterm, n.pindex, n.id, _EMPTY_}
	subj, reply := n.vsubj, n.vreply
	n.Unlock()

	n.debug("Sending out voteRequest %+v", vr)

	// Now send it out.
	n.sendRPC(subj, reply, vr.encode())
}

func (n *raft) sendRPC(subject, reply string, msg []byte) {
	n.t.Publish(subject, reply, msg)
}

func (n *raft) sendReply(subject string, msg []byte) {
	n.t.Publish(subject, _EMPTY_, msg)

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Repair the storage issue preventing term_vote writes
  2. The node remains candidate and will campaign again in a later timeout
  3. Monitor for repeated failures which block this node from ever winning elections
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at server/raft.go:5694 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/9c16723a67047048. Report an issue: GitHub.