{"record":{"id":"77c05e63d22d8aa1","repo":"block/buzz","slug":"channel-target-not-found-in-community","errorCode":null,"errorMessage":"channel {target} not found in community {}","messagePattern":"channel (.+?) not found in community (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/buzz-admin/src/main.rs","lineNumber":668,"sourceCode":"            );\n            eprintln!(\"Events signed with this key won't be verifiable after this run.\");\n            eprintln!(\"Pass --relay-key or set BUZZ_RELAY_PRIVATE_KEY for production use.\");\n            k\n        }\n    };\n\n    let tenant = resolve_admin_tenant(&db).await?;\n    let target_channel = channel_arg\n        .as_deref()\n        .map(uuid::Uuid::parse_str)\n        .transpose()\n        .map_err(|e| anyhow::anyhow!(\"invalid --channel UUID: {e}\"))?;\n    let channels = if let Some(target) = target_channel {\n        vec![db\n            .get_channel(tenant.community(), target)\n            .await\n            .map_err(|_| {\n                anyhow::anyhow!(\"channel {target} not found in community {}\", tenant.host())\n            })?]\n    } else {\n        db.list_channels(tenant.community(), None).await?\n    };\n    if channels.is_empty() {\n        println!(\"No channels in database.\");\n        return Ok(());\n    }\n\n    let mut reconciled = 0u32;\n    let mut skipped = 0u32;\n\n    for channel in &channels {\n        let channel_id_str = channel.id.to_string();\n\n        // Check if kind:39000 already exists\n        let existing = db\n            .query_events(&EventQuery {","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/block/buzz/blob/ef2aa1ae38fadcc0bc22b8bf6ed96b35933146be/crates/buzz-admin/src/main.rs#L650-L686","documentation":"After parsing the UUID, reconcile-channels calls db.get_channel(community, target). A miss is reported as 'channel {target} not found in community {host}'. Note the mapping is lossy: map_err(|_| ...) collapses any DB error into the same message, so a genuine database failure masquerades as a missing channel. The community is the one resolved from RELAY_URL (see error 26), so a valid channel in a different community is invisible here.","triggerScenarios":"The UUID is syntactically valid but no channels row has that id in the resolved community; RELAY_URL points at community A while the channel lives in community B; or the underlying Postgres query errored (connectivity, permissions) and got the same message.","commonSituations":"Copying a channel id from a staging relay and running the CLI against local; running after switching RELAY_URL/DATABASE_URL; two communities sharing a host prefix.","solutions":["Confirm which community you are on: SELECT id, host FROM communities; and match it to RELAY_URL's authority (host + port).","List the channels that ARE visible: SELECT id, name FROM channels WHERE community_id = '<that id>'; and use one of those ids.","If the list query also fails, suspect the DB itself — check DATABASE_URL connectivity (this error text cannot distinguish the two).","Omit --channel to reconcile every channel in the resolved community."],"exampleFix":"# before\nRELAY_URL=ws://relay.example:8443 buzz-admin reconcile-channels --channel <uuid-from-local-dev>\n# after\nRELAY_URL=ws://localhost:3000 buzz-admin reconcile-channels --channel <uuid-from-SELECT-id,name-FROM-channels>","handlingStrategy":"validation","validationCode":"-- prove the channel exists in the community you are about to operate on\nSELECT c.id, c.name FROM channels c\nJOIN communities m ON m.id = c.community_id\nWHERE c.id = '<uuid>' AND m.host = 'localhost:3000'; -- = authority of RELAY_URL\n-- zero rows => wrong community or wrong id; do not run reconcile","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve community and channel in one query before running reconcile-channels.","Pin RELAY_URL in the same script that supplies --channel so the two can never drift apart.","Treat 'not found' from this CLI as ambiguous — if a plain channels list also fails, suspect the database, not the id."],"tags":["buzz-admin","not-found","channel","multi-tenant","reconcile-channels"],"backgroundTag":"entity-not-found","analyzedSha":"ef2aa1ae38fadcc0bc22b8bf6ed96b35933146be","analyzedAt":"2026-08-20T04:38:24.874Z","contentChangedAt":"2026-08-20T04:38:24.874Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}