{"record":{"id":"86c0650ae79dca06","repo":"block/buzz","slug":"cannot-derive-community-host-from-relay-url-pass","errorCode":null,"errorMessage":"cannot derive community host from RELAY_URL; pass --host or set a valid RELAY_URL","messagePattern":"cannot derive community host from RELAY_URL; pass --host or set a valid RELAY_URL","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/buzz-deletion/src/lib.rs","lineNumber":520,"sourceCode":"\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?;\n    Ok(store(&db))\n}\n\nfn resolve_s3_region(buzz_region: Option<String>, aws_region: Option<String>) -> String {","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/block/buzz/blob/f956e6fe06a76e50cbd8fba1a162482e752e7f1a/crates/buzz-deletion/src/lib.rs#L502-L538","documentation":"RELAY_URL WAS provided (non-empty after trim), but buzz_core::tenant::relay_url_authority() returned an empty authority for it, so resolve_submit_host() cannot derive a community host. The authority helper extracts host + explicit non-default port; it yields empty for values that are not parseable URLs with a usable host — no scheme/bad scheme, empty host, or a bare string the URL parser rejects. Distinct from error 33, which fires when RELAY_URL is missing entirely.","triggerScenarios":"RELAY_URL=\"localhost:3000\" (no ws:// scheme), RELAY_URL=\"buzz-relay\" (bare word), RELAY_URL=\"ws://\" (no host), or a URL with only an opaque path. Each parses without a host, so relay_url_authority returns \"\" and this error fires.","commonSituations":"Operators shortening the env var to host:port assuming scheme doesn't matter; docker-compose values interpolated to empty; RELAY_URL confused with DATABASE_URL host formats; YAML env entries losing the scheme through templating.","solutions":["Set RELAY_URL as a full WebSocket URL including scheme: ws://localhost:3000 (dev) or wss://relay.example.com (prod).","Or bypass derivation with an explicit `--host relay.example.com` (authority form: host, plus non-default port such as localhost:3000).","Echo-check the value in the exact execution context (`echo \"[$RELAY_URL]\"`) to catch interpolation/templating that stripped the scheme.","Keep the same URL clients use — the derived authority must match the host string the relay seeded at startup."],"exampleFix":"# before\nRELAY_URL=localhost:3000 buzz-deletion submit ...\n# error: cannot derive community host from RELAY_URL; ...\n\n# after\nRELAY_URL=ws://localhost:3000 buzz-deletion submit ...","handlingStrategy":"validation","validationCode":"# RELAY_URL must be a full ws(s) URL with a host, or derivation fails\nurl=\"${RELAY_URL:-}\"\nif ! [[ \"$url\" =~ ^wss?://[^/:]+ ]]; then\n  echo \"RELAY_URL must look like ws://host:port or wss://host — got: '$url'\" >&2; exit 1\nfi","typeGuard":"function isRelayUrl(v: string): boolean {\n  return /^wss?:\\/\\/[a-zA-Z0-9.\\[\\]-]+(:\\d+)?/.test(v);\n}","tryCatchPattern":null,"preventionTips":["Always include the scheme in RELAY_URL — host:port alone is rejected by derivation.","Lint env files: RELAY_URL must start with ws:// or wss://.","Use the same URL string as the relay's public config so derived authority matches the seeded host."],"tags":["buzz-deletion","relay-url","url-parsing","host-resolution"],"backgroundTag":"invalid-url-format","analyzedSha":"f956e6fe06a76e50cbd8fba1a162482e752e7f1a","analyzedAt":"2026-08-16T22:11:40.750Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}