propose
Proposes command for replication and suspends until a quorum commits it.
Returns the committed LogEntry (which carries the assigned LogEntry.index and LogEntry.term).
May be called from any node in the cluster (Raft §8):
The leader appends the entry directly.
Every other role (Follower, Candidate, Learner) forwards the command to the current leader and suspends until the leader commits it. The committed entry then replicates back to the calling node through the normal AppendEntries path.
If no leader is known yet (during an election), the call waits, cancellably, until a leader is elected and then forwards.
Cancellation is best-effort. A forward still waiting for a leader when the caller cancels is guaranteed not to be sent. However, a command already forwarded to — or appended by — the leader may still commit even if the caller cancels; Raft does not support revocation of in-flight proposals. A non-leader releases its forwarding copy of command once the caller cancels, so a timeout-and-retry loop does not accumulate them there. A leader's entries stay in its log.
A forwarded proposal relies on caller-side timeout for a leader crash. If the leader a proposal was forwarded to steps down, its rejection surfaces here as LeadershipLostException (retry below). But if that leader crashes, no rejection is ever delivered, so this call suspends until the caller cancels it — the library does not spontaneously fail such a proposal. Wrap propose in your own timeout and retry against the next leader; use the requestId overload so the retry is exactly-once-safe, and retry before issuing a higher requestId, for the reason that overload gives. (This is the standard distributed-propose contract: eventual completion of a forwarded proposal is a caller timeout+retry responsibility, not a library guarantee.)
A torn transport seam does not end the node. Over a SeamRaftTransport whose seam is torn, the node stays up and drops every send, so a follower's forward is never answered and this call suspends until the caller cancels it. Nothing ends the node: the owner must watch seam.state and close the node or cancel its scope. This gap is tracked by #3053.
Throws
on a node with a ClientIdentity.Durable id, before anything is drawn or sent: a serial the node drew for itself cannot be persisted before it is issued, so that identity's floor could not cover it. Use the requestId overload.
if a forwarded proposal is rejected by the target leader (e.g. the leader stepped down); the caller may retry on the new leader.
if the leader a proposal was forwarded to reports it failed for a non-retryable reason. Do not retry the same command. No leader in this release reports one (#2922).
only in terminal cases: the node is closed, or the leader is rejecting proposals because a leadership transfer is in flight. A torn transport seam is not one of them: the call suspends instead (see above, #3053).
if command exceeds the transport's published payload budget less an envelope reserve (#2069). The caller preflight refuses before drawing a serial. Admission checks again on the actor, before forwarding or appending, so a changed budget can refuse after a serial was drawn. A non-leader may also receive the leader's refusal when that budget is smaller (#2155); then the numbers are the leader's. This attempt appends nothing, and a new proposal with a smaller command is safe. A transport that publishes no budget imposes no local limit. A size refusal is never a LeadershipLostException.
Proposes command with a caller-pinned requestId (Raft §8 client serial) under this node's clientId, then suspends until a quorum commits it (same semantics as propose).
A durable client replays the same requestId on a post-crash retry to get exactly-once across the crash: the proposer stamps DedupKey(clientId, requestId) onto the entry, it rides the forward hop unchanged, and the consumer's dedup table (ClientSessionTable) skips a serial it has already applied. The auto-serial propose form draws the next monotonic serial itself, and is refused under a durable id.
Under ClientIdentity.Durable, commit a new requestId as the id's issuedThrough, with the command bytes a retry would have to resend, before this call: ClientIdentity.Durable says what a stale floor gets. A retry needs no new write.
Do not issue a higher requestId while a lower one is unresolved: issuing it abandons the lower one. A consumer's ClientSessionTable keeps one high-water serial per id, so a later retry of the lower serial returns success, commits, and is dropped. A caller's own timeout gets there as surely as a crash. So when this call times out, retry the same requestId and only then issue the next. That gap is tracked by #3107.
A requestId names one command: a retry must carry the same command bytes. While the current leader holds the committed result in its best-effort cache, a retry gets that result back, even if the leader's payload limit has since shrunk below the command. The cache lasts for that leader's tenure and is dropped when it steps down. A non-leader still checks its own forward-hop budget before sending, even for a committed retry; the leader's cache cannot bypass that hop.
Throws
if a required forward hop cannot fit command, or the leader has no cached result and the command exceeds its current payload budget less the envelope reserve. This attempt appends nothing; it does not prove an earlier attempt never committed. Do not reuse requestId for a smaller command after an ambiguous earlier attempt.