block/buzz · error · anyhow::Error

setup-mode channel discovery error: {e}

Error message

setup-mode channel discovery error: {e}

What it means

Setup mode's channel discovery (discover_channels) failed before the mentions-only subscription rules could be built. It is the same discovery call as normal startup, wrapped with a setup-mode-specific message; the harness cannot build channel-scoped rules without it and exits.

Source

Thrown at crates/buzz-acp/src/setup_mode.rs:359

        .await
        .map_err(|e| anyhow::anyhow!("setup-mode membership subscribe error: {e}"))?;

    tracing::info!("setup-mode: connected and subscribed to membership notifications");

    let rest_client = relay.rest_client();
    let mut author_gate_ctx =
        crate::InboundAuthorGate::connect(&rest_client, &pubkey_hex, "setup startup").await;

    // Resolve owner for author-gate (same priority as normal mode).
    let startup_owner = crate::resolve_agent_owner(&config);
    let owner_cache = crate::OwnerCache::new(startup_owner);

    // Discover channels and subscribe (using a "mentions" rule so we get
    // notified when someone @-mentions the agent).
    let channel_info_map = relay
        .discover_channels()
        .await
        .map_err(|e| anyhow::anyhow!("setup-mode channel discovery error: {e}"))?;

    tracing::info!(
        "setup-mode: discovered {} channel(s)",
        channel_info_map.len()
    );

    let channel_ids: Vec<Uuid> = channel_info_map.keys().copied().collect();

    // Build subscription rules: mentions only (setup mode must not react to
    // every message in a channel).
    let rules = build_setup_subscription_rules(&config);

    let channel_filters = crate::config::resolve_channel_filters(&config, &channel_ids, &rules);

    if channel_filters.is_empty() {
        tracing::warn!(
            "setup-mode: no channel subscriptions resolved — nudge listener will sit idle"
        );

View on GitHub (pinned to dad5a33865)

Solutions

  1. Verify the relay is still up and the auth env is correct
  2. Retry the setup-mode run once the relay is stable
  3. Inspect relay logs if discovery keeps failing while other subscriptions succeed
Defensive patterns

Strategy: retry

Validate before calling

# Preflight: relay healthy before entering setup mode
curl -fsS "$(echo "$BUZZ_RELAY_URL" | sed 's|^ws\(s\)\?://|http\1://')/health" >/dev/null \
  || { echo 'relay health check failed' >&2; exit 1; }

Try / catch

// Retry the discovery step independently; keep already-established subscriptions
match relay.discover_channels().await {
    Err(e) if attempt < MAX => { backoff.wait().await; retry!(); }
    other => other?,
}

Prevention

When it happens

Trigger: The relay drops or rejects the discovery query while the harness is in setup mode — transient disconnect right after the membership subscription succeeded, auth-scope rejection, or relay-side DB error.

Common situations: Relay restart mid-setup; wrong community host in BUZZ_RELAY_URL; relay briefly unavailable (Postgres restart) during onboarding flows.

Related errors


AI-assisted analysis of block/buzz@dad5a33865 (2026-08-20). Data as JSON: /api/errors/607d63eebfcb0948. Report an issue: GitHub.