block/buzz · critical · anyhow::Error

Failed to bootstrap relay owner (required when BUZZ_REQUIRE_

Error message

Failed to bootstrap relay owner (required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true): {e}

What it means

bootstrap_owner() guarantees the configured RELAY_OWNER_PUBKEY holds the owner role within the deployment community. With enforcement on, a failed bootstrap means no one can administer the relay, so startup aborts with the DB error appended; without enforcement the failure is logged non-fatally.

Source

Thrown at crates/buzz-relay/src/main.rs:335

                }
            }
        }
    }

    // NIP-43: ensure the configured relay owner always holds the owner role
    // within the deployment community.
    if let (Some(community), Some(owner_pubkey)) =
        (deployment_community, config.relay_owner_pubkey.as_ref())
    {
        match db.bootstrap_owner(community, owner_pubkey).await {
            Ok(()) => info!(pubkey = %owner_pubkey, "Relay owner bootstrapped"),
            Err(e) => {
                if config.require_relay_membership {
                    // Membership enforcement is on — a missing owner means no one
                    // can administer the relay. Fail fast rather than silently start
                    // in a broken state.
                    error!("Fatal: failed to bootstrap relay owner with membership enforcement enabled: {e}");
                    return Err(anyhow::anyhow!(
                        "Failed to bootstrap relay owner (required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true): {e}"
                    ));
                } else {
                    error!(
                        "Failed to bootstrap relay owner (non-fatal, membership not required): {e}"
                    );
                }
            }
        }
    }

    // NIP-33: backfill d_tag for any existing parameterized replaceable events
    // that predate the column addition. Idempotent — no-ops when fully populated.
    match db.backfill_d_tags().await {
        Ok(0) => {}
        Ok(n) => info!("Backfilled d_tag for {n} NIP-33 events"),
        Err(e) => error!("Failed to backfill d_tags: {e}"),
    }

View on GitHub (pinned to f956e6fe06)

Solutions

  1. Check the DB error detail, resolve, and retry boot — the operation is idempotent
  2. Inspect the community and relay_members rows for the owner pubkey for conflicts
  3. Confirm RELAY_OWNER_PUBKEY is the intended 64-char hex key and not a stale value
Defensive patterns

Strategy: retry

Validate before calling

# Owner bootstrap needs a writable community + membership rows.
psql "$DATABASE_URL" -tAc "select count(*) from relay_members" | grep -qv '^0$' || echo 'warn: no members yet — bootstrap will create the owner'

Try / catch

# k8s: transient boot failures resolve on restart; bootstrap is idempotent
spec:
  restartPolicy: Always

Prevention

When it happens

Trigger: DB failure upserting the owner's membership role; community/relay_members rows in a state the bootstrap cannot satisfy (e.g. conflicting prior owner rows).

Common situations: Owner pubkey rotated without reconciling old rows; transient DB errors at boot; restored database with inconsistent membership state.

Related errors


AI-assisted analysis of block/buzz@f956e6fe06 (2026-08-16). Data as JSON: /api/errors/e4100795a3bf37d8. Report an issue: GitHub.