block/buzz · error · anyhow::Error

channel discovery error: {e}

Error message

channel discovery error: {e}

What it means

discover_channels() is the harness's startup query that enumerates the community's channels (channel_info_map) before subscription rules are built. Its failure aborts harness startup with this wrapped error — no channels means no subscription rules can be constructed.

Source

Thrown at crates/buzz-acp/src/lib.rs:2710

                    relay_observer_control_rx = relay.take_observer_control_rx();
                    tracing::info!("relay observer enabled");
                }
                Err(error) => {
                    tracing::warn!("relay observer disabled: invalid owner pubkey: {error}");
                }
            }
        } else {
            tracing::warn!(
                "relay observer requested but no agent owner was resolved at startup; \
                 observer frames will not be published"
            );
        }
    }

    let channel_info_map = relay
        .discover_channels()
        .await
        .map_err(|e| anyhow::anyhow!("channel discovery error: {e}"))?;

    tracing::info!("discovered {} channel(s)", channel_info_map.len());
    let channel_ids: Vec<Uuid> = channel_info_map.keys().copied().collect();

    let rules: Vec<SubscriptionRule> = match config.subscribe_mode {
        SubscribeMode::Mentions => {
            vec![SubscriptionRule {
                name: "mentions".into(),
                channels: filter::ChannelScope::All("all".into()),
                kinds: config.kinds_override.clone().unwrap_or_else(|| {
                    vec![
                        KIND_STREAM_MESSAGE,
                        KIND_WORKFLOW_APPROVAL_REQUESTED,
                        KIND_STREAM_REMINDER,
                    ]
                }),
                require_mention: !config.no_mention_filter,
                filter: None,

View on GitHub (pinned to dad5a33865)

Solutions

  1. Confirm the relay is up and reachable (curl the NIP-11 endpoint of the same host)
  2. Verify BUZZ_RELAY_URL points at the intended community and the auth env vars are set
  3. Retry harness startup after the relay is healthy
  4. Check relay-side logs for the failed query if retries keep failing
Defensive patterns

Strategy: retry

Validate before calling

# Preflight: confirm the relay is serving before starting the harness
curl -fsS "$(echo "$BUZZ_RELAY_URL" | sed 's|^ws\(s\)\?://|http\1://')/" >/dev/null \
  || { echo 'relay not reachable' >&2; exit 1; }

Try / catch

// Treat discovery failure as transient; abort only after backoff is exhausted
match relay.discover_channels().await {
    Err(e) if retryable(&e) && attempt < MAX => { backoff.wait().await; continue; }
    other => return other.map(|_| ()),
}

Prevention

When it happens

Trigger: The relay connection drops between connect and discovery, the discovery REQ is rejected by the relay (auth token missing the community scope), or the relay's DB errors while serving the query.

Common situations: Relay restarting under the harness; wrong community host in BUZZ_RELAY_URL so the query hits a relay that rejects it; expired NIP-42 auth; Postgres briefly unavailable on the relay side.

Related errors


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