block/buzz · error · anyhow::Error

--host must not be empty

Error message

--host must not be empty

What it means

resolve_submit_host trims the --host argument and rejects a whitespace-only value. An empty host would otherwise be submitted as the community host and produce a nonsense tenant scoping downstream, so the deletion CLI fails fast on the empty flag.

Solutions

  1. Pass a real community host (the relay authority, e.g. buzz.example.com)
  2. Or omit --host entirely and rely on RELAY_URL derivation
  3. Guard the calling script: [ -n "${COMMUNITY_HOST// /}" ] || { echo 'host required'; exit 1; }

Example fix

# before
buzz-deletion submit --host "$COMMUNITY_HOST" ...
# (COMMUNITY_HOST unset -> expands to empty)
# after
buzz-deletion submit --host "buzz.example.com" ...
# or: export RELAY_URL=wss://buzz.example.com and omit --host
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
host="${1:-}"
[ -n "${host// /}" ] || { echo "--host must not be empty" >&2; exit 1; }

Prevention

When it happens

Trigger: Invoking the buzz-deletion submit flow with --host "" or --host " " (e.g. from a shell script where $HOST expanded to an empty or blank string).

Common situations: CI scripts passing an unset variable: --host "$COMMUNITY_HOST" with the variable empty; copy-pasted commands with a placeholder that was never filled in.

Related errors


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

Appendix: source

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

                .await?;
            print_json(&sweep)?;
            Ok(i32::from(sweep.unknown_object_count > 0))
        }
        Command::List { .. }
        | Command::Inspect { .. }
        | Command::Approve { .. }
        | Command::Abort { .. }
        | Command::Unblock { .. } => {
            anyhow::bail!("database-only command reached full-service dispatcher")
        }
    }
}

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)
}

View on GitHub (pinned to dad5a33865)