block/buzz · critical · anyhow::Error
Failed to backfill pubkey_allowlist (required when BUZZ_REQU
Error message
Failed to backfill pubkey_allowlist (required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true): {e} What it means
backfill_from_allowlist() migrates existing pubkey_allowlist entries into relay_members for the deployment community, deliberately before owner bootstrap so enabling membership does not lock existing users out. With enforcement on, any DB failure during this idempotent migration is fatal; without enforcement it is logged and skipped.
Source
Thrown at crates/buzz-relay/src/main.rs:312
}
}
}
};
// NIP-43: migrate any existing pubkey_allowlist entries to relay_members.
// Idempotent — safe to run every startup. Must run before bootstrap_owner
// so that existing allowlist users become relay members before the owner
// is promoted (otherwise enabling membership locks everyone out).
if let Some(community) = deployment_community {
match db.backfill_from_allowlist(community).await {
Ok(0) => {}
Ok(n) => info!("Backfilled {n} pubkey_allowlist entries into relay_members"),
Err(e) => {
if config.require_relay_membership {
error!(
"Fatal: failed to backfill allowlist with membership enforcement enabled: {e}"
);
return Err(anyhow::anyhow!(
"Failed to backfill pubkey_allowlist (required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true): {e}"
));
} else {
error!("Failed to backfill pubkey_allowlist (non-fatal): {e}");
}
}
}
}
// 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 {View on GitHub (pinned to f956e6fe06)
Solutions
- Inspect {e} for the failing statement or constraint
- Ensure migrations are current so relay_members matches the expected shape
- Retry boot — the backfill is idempotent and resumes cleanly
Defensive patterns
Strategy: retry
Validate before calling
# The backfill writes relay_members: confirm the table is reachable and writable.
psql "$DATABASE_URL" -c 'select 1 from relay_members limit 1' || { echo 'relay_members unreadable'; exit 1; } Try / catch
# docker-compose: bounded restarts; the backfill is idempotent and resumes relay: restart: on-failure:5
Prevention
- Apply migrations before enabling membership enforcement so relay_members exists
- Run the enforcement rollout against a rehearsed copy of the allowlist first
- Watch the 'Backfilled N pubkey_allowlist entries' log to confirm completion after restart
When it happens
Trigger: DB write errors inserting relay_members rows; duplicate/conflicting rows from a partially completed earlier backfill; schema drift after skipped migrations.
Common situations: Enabling NIP-43 enforcement on an older deployment with a populated allowlist; a previous boot crashed mid-backfill; replica-promoted DB with constraint drift.
Related errors
- Failed to bootstrap relay owner (required when BUZZ_REQUIRE_
- DB connection failed: {e}
- Database migration failed: {e}
- Community deletion serving fence is unsafe: {e}
- RELAY_OWNER_PUBKEY required when BUZZ_REQUIRE_RELAY_MEMBERSH
AI-assisted analysis of block/buzz@f956e6fe06 (2026-08-16).
Data as JSON: /api/errors/8f7bd4781467cee0.
Report an issue: GitHub.