block/buzz · error · anyhow::Error

cannot derive community host from RELAY_URL; pass --host or…

Error message

cannot derive community host from RELAY_URL; pass --host or set a valid RELAY_URL

What it means

When --host is not given, the deletion CLI derives the community host from RELAY_URL via buzz_core::tenant::relay_url_authority. This error means RELAY_URL was unset/blank, or its authority parsed empty — typically a URL without a scheme such as localhost:3000.

Solutions

  1. Export a fully-qualified relay URL: export RELAY_URL=wss://buzz.example.com (or ws://localhost:3000 for local dev)
  2. Or pass the host explicitly: --host buzz.example.com
  3. Verify with: echo "$RELAY_URL" and confirm the scheme is present

Example fix

# before
export RELAY_URL=localhost:3000
# after
export RELAY_URL=ws://localhost:3000
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# require a schemed relay URL before running deletion commands
: "${RELAY_URL:?set RELAY_URL (ws:// or wss://) or pass --host}"
case "$RELAY_URL" in ws://*|wss://*) ;; *) echo "RELAY_URL must start with ws:// or wss://" >&2; exit 1;; esac

Prevention

When it happens

Trigger: Running a submit command with neither --host nor a usable RELAY_URL; or RELAY_URL="localhost:3000" / RELAY_URL="buzz.example.com" without the ws:// or wss:// prefix, so the authority extraction returns an empty string.

Common situations: Fresh shell without .env sourced; docker-compose env passthrough dropped; a RELAY_URL value written without a scheme by a deployment script.

Related errors


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

Appendix: source

Thrown at crates/buzz-deletion/src/lib.rs:525

fn resolve_submit_host(host: Option<&str>, relay_url: Option<&str>) -> Result<String> {
    if let Some(host) = host {
        let host = host.trim();
        if host.is_empty() {
            anyhow::bail!("--host must not be empty");
        }
        return Ok(host.to_owned());
    }

    let relay_url = relay_url
        .map(str::trim)
        .filter(|value| !value.is_empty())
        .ok_or_else(|| {
            anyhow::anyhow!("cannot derive community host; pass --host or set RELAY_URL")
        })?;
    let host = buzz_core::tenant::relay_url_authority(relay_url);
    if host.is_empty() {
        anyhow::bail!(
            "cannot derive community host from RELAY_URL; pass --host or set a valid RELAY_URL"
        );
    }
    Ok(host)
}

async fn connect_store() -> Result<DeletionStore> {
    let database_url = required_env("DATABASE_URL")?;
    let db = Db::new(
        &DbConfig {
            database_url,
            max_connections: env_parse("BUZZ_DB_POOL_SIZE", 20),
            ..DbConfig::default()
        }
        .with_session_timeouts_from_env(),
    )
    .await?;
    Ok(store(&db))

View on GitHub (pinned to dad5a33865)