{"record":{"id":"607d63eebfcb0948","repo":"block/buzz","slug":"setup-mode-channel-discovery-error-e","errorCode":null,"errorMessage":"setup-mode channel discovery error: {e}","messagePattern":"setup-mode channel discovery error: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/buzz-acp/src/setup_mode.rs","lineNumber":359,"sourceCode":"        .await\n        .map_err(|e| anyhow::anyhow!(\"setup-mode membership subscribe error: {e}\"))?;\n\n    tracing::info!(\"setup-mode: connected and subscribed to membership notifications\");\n\n    let rest_client = relay.rest_client();\n    let mut author_gate_ctx =\n        crate::InboundAuthorGate::connect(&rest_client, &pubkey_hex, \"setup startup\").await;\n\n    // Resolve owner for author-gate (same priority as normal mode).\n    let startup_owner = crate::resolve_agent_owner(&config);\n    let owner_cache = crate::OwnerCache::new(startup_owner);\n\n    // Discover channels and subscribe (using a \"mentions\" rule so we get\n    // notified when someone @-mentions the agent).\n    let channel_info_map = relay\n        .discover_channels()\n        .await\n        .map_err(|e| anyhow::anyhow!(\"setup-mode channel discovery error: {e}\"))?;\n\n    tracing::info!(\n        \"setup-mode: discovered {} channel(s)\",\n        channel_info_map.len()\n    );\n\n    let channel_ids: Vec<Uuid> = channel_info_map.keys().copied().collect();\n\n    // Build subscription rules: mentions only (setup mode must not react to\n    // every message in a channel).\n    let rules = build_setup_subscription_rules(&config);\n\n    let channel_filters = crate::config::resolve_channel_filters(&config, &channel_ids, &rules);\n\n    if channel_filters.is_empty() {\n        tracing::warn!(\n            \"setup-mode: no channel subscriptions resolved — nudge listener will sit idle\"\n        );","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-acp/src/setup_mode.rs#L341-L377","documentation":"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.","triggerScenarios":"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.","commonSituations":"Relay restart mid-setup; wrong community host in BUZZ_RELAY_URL; relay briefly unavailable (Postgres restart) during onboarding flows.","solutions":["Verify the relay is still up and the auth env is correct","Retry the setup-mode run once the relay is stable","Inspect relay logs if discovery keeps failing while other subscriptions succeed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# Preflight: relay healthy before entering setup mode\ncurl -fsS \"$(echo \"$BUZZ_RELAY_URL\" | sed 's|^ws\\(s\\)\\?://|http\\1://')/health\" >/dev/null \\\n  || { echo 'relay health check failed' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"// Retry the discovery step independently; keep already-established subscriptions\nmatch relay.discover_channels().await {\n    Err(e) if attempt < MAX => { backoff.wait().await; retry!(); }\n    other => other?,\n}","preventionTips":["Run setup-mode onboarding against a stable relay (not one mid-restart or mid-migration)","Instrument the harness to distinguish discovery failures from earlier connect/subscribe failures in logs"],"tags":["buzz-acp","relay","channels","discovery","setup-mode","network"],"backgroundTag":"relay-request-failed","analyzedSha":"dad5a33865fc81a2e55b3b60746632f615ec1e3a","analyzedAt":"2026-08-20T04:38:24.874Z","contentChangedAt":"2026-08-20T04:38:24.874Z","schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}