{"record":{"id":"7bf2568e6fdb1fe9","repo":"block/buzz","slug":"cannot-derive-community-host-pass-host-or-set-r","errorCode":null,"errorMessage":"cannot derive community host; pass --host or set RELAY_URL","messagePattern":"cannot derive community host; pass --host or set RELAY_URL","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/buzz-deletion/src/lib.rs","lineNumber":516,"sourceCode":"            anyhow::bail!(\"database-only command reached full-service dispatcher\")\n        }\n    }\n}\n\nfn resolve_submit_host(host: Option<&str>, relay_url: Option<&str>) -> Result<String> {\n    if let Some(host) = host {\n        let host = host.trim();\n        if host.is_empty() {\n            anyhow::bail!(\"--host must not be empty\");\n        }\n        return Ok(host.to_owned());\n    }\n\n    let relay_url = relay_url\n        .map(str::trim)\n        .filter(|value| !value.is_empty())\n        .ok_or_else(|| {\n            anyhow::anyhow!(\"cannot derive community host; pass --host or set RELAY_URL\")\n        })?;\n    let host = buzz_core::tenant::relay_url_authority(relay_url);\n    if host.is_empty() {\n        anyhow::bail!(\n            \"cannot derive community host from RELAY_URL; pass --host or set a valid RELAY_URL\"\n        );\n    }\n    Ok(host)\n}\n\nasync fn connect_store() -> Result<DeletionStore> {\n    let database_url = required_env(\"DATABASE_URL\")?;\n    let db = Db::new(&DbConfig {\n        database_url,\n        max_connections: env_parse(\"BUZZ_DB_POOL_SIZE\", 20),\n        ..DbConfig::default()\n    })\n    .await?;","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/block/buzz/blob/f956e6fe06a76e50cbd8fba1a162482e752e7f1a/crates/buzz-deletion/src/lib.rs#L498-L534","documentation":"resolve_submit_host() needs a community host to scope a deletion request. It first checks --host; when that is absent it falls back to deriving the host from RELAY_URL via buzz_core::tenant::relay_url_authority. This error means NEITHER was usable: --host was not passed and RELAY_URL is unset, empty, or only whitespace after trimming. Deletion is scoped per community, so the tool refuses to guess.","triggerScenarios":"Running `buzz-deletion submit …` (or any command routed through resolve_submit_host) in a shell where RELAY_URL was never exported and no --host flag was given; a systemd/cron unit that only sets DATABASE_URL/S3 vars; whitespace-only RELAY_URL=\"   \" from a template.","commonSituations":"Deletion executor deployed without copying the relay's full env set; scripts written against dev (where a global export existed) run in CI where it doesn't; .env sourced from the wrong directory.","solutions":["Set RELAY_URL to the relay's URL (e.g. ws://localhost:3000 or wss://relay.example.com) in the environment and re-run — the host (plus non-default port) is derived the same way the relay seeds it.","Or pass the community authority directly: `--host localhost:3000` / `--host relay.example.com`.","For service units, add RELAY_URL (or bake --host into ExecStart) so it doesn't depend on an interactive shell's exports.","Check for empty-but-set values: `echo \"[$RELAY_URL]\"` — whitespace-only counts as missing here."],"exampleFix":"# before\nbuzz-deletion submit --requester npub1... --reason \"gdpr\"\n# error: cannot derive community host; pass --host or set RELAY_URL\n\n# after\nRELAY_URL=ws://localhost:3000 buzz-deletion submit --requester npub1... --reason \"gdpr\"\n# or: buzz-deletion submit --host localhost:3000 --requester npub1... --reason \"gdpr\"","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# deletion commands need a scoping host one way or another\nif [ -z \"${RELAY_URL// /}\" ] && [ -z \"${HOST_ARG:-}\" ]; then\n  echo \"set RELAY_URL (ws://host:port) or pass --host\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake RELAY_URL into the deletion executor's unit/env file so hosts are never guessed.","Prefer explicit --host in scripts: it reads as documentation of which community is targeted."],"tags":["buzz-deletion","env-var","host-resolution","configuration"],"backgroundTag":"missing-configuration","analyzedSha":"f956e6fe06a76e50cbd8fba1a162482e752e7f1a","analyzedAt":"2026-08-16T22:11:40.750Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}