risingwavelabs/risingwave · critical · MetaError

Election failed

Error message

Election failed: {0}

What it means

MetaError::ElectionFailed: the meta-node failed in a leader-election operation (e.g. acquiring or renewing leadership via the election backend). Wrapped error carries the backend-specific reason; typically indicates metastore/etcd connectivity or session issues.

Solutions

  1. Inspect the `#[source]`/cause chain for the underlying election failure.
  2. Check etcd (or configured meta store) health and connectivity.
  3. Confirm only the intended meta nodes participate in election and their config matches.
  4. Restart the meta node; if the lease is stuck, wait for TTL expiry or clear the stale leader key.
Defensive patterns

Strategy: retry

Try / catch

match meta_result {
    Err(MetaError::Election(cause)) => { /* inspect cause, check etcd, retry after leader re-elected */ }
    other => other?,
}

Prevention

When it happens

Trigger: meta node startup when it cannot acquire the leader lease (etcd errors, another leader active), lease renewal failure during runtime causing leadership loss.

Common situations: etcd connection problems or timeouts, split-brain protection rejecting election, clock skew affecting lease TTLs, misconfigured election keys.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/8d9988becc36d076. Report an issue: GitHub.

Appendix: source

Thrown at src/meta/src/error.rs:94

    #[error("{0} id not found: {1}")]
    #[construct(skip)]
    CatalogIdNotFound(&'static str, String),

    #[error("table_fragment does not exist: id={0}")]
    FragmentNotFound(FragmentId),

    #[error("{0} named {1} already exists{under_creation}", under_creation = (.2).map(|_| " and is still being created").unwrap_or(""))]
    Duplicated(
        &'static str,
        String,
        // if under creation, take streaming job id, otherwise None
        Option<JobId>,
    ),

    #[error("Service unavailable: {0}")]
    Unavailable(#[message] String),

    #[error("Election failed: {0}")]
    Election(#[source] BoxedError),

    #[error("Cancelled: {0}")]
    Cancelled(String),

    #[error("System parameters error: {0}")]
    SystemParams(String),

    #[error("Session parameters error: {0}")]
    SessionConfig(
        #[from]
        #[backtrace]
        SessionConfigError,
    ),

    #[error(transparent)]
    Connector(
        #[from]

View on GitHub (pinned to 6469eb736d)