block/buzz · error · anyhow::Error

--host must not be empty

Error message

--host must not be empty

What it means

resolve_submit_host() in buzz-deletion trims the --host argument and rejects it when the trimmed value is empty. The host names the community whose data deletion operates on, and an empty string would otherwise silently look up a bogus tenant. Note only an EXPLICIT empty --host triggers this — omitting --host entirely falls through to RELAY_URL derivation (or a separate 'cannot derive' error).

Source

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

                .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 f956e6fe06)

Solutions

  1. Find why the variable is empty: `echo "[$COMMUNITY_HOST]"` in the same shell/script that builds the command.
  2. Either export a real community host (e.g. localhost:3000 or relay.example.com — same authority form the relay seeded) or drop --host entirely and set RELAY_URL instead.
  3. Guard the wrapper: skip the command (or fail with your own message) when the variable is unset, instead of passing an empty string.

Example fix

# before
COMMUNITY_HOST="" buzz-deletion submit --host "$COMMUNITY_HOST" ...
# error: --host must not be empty

# after
: "${COMMUNITY_HOST:=localhost:3000}"
buzz-deletion submit --host "$COMMUNITY_HOST" ...
Defensive patterns

Strategy: validation

Validate before calling

# in wrappers, never pass through an empty host
host="${COMMUNITY_HOST:-}"
if [[ -z "${host// /}" ]]; then
  echo "refusing to pass empty --host" >&2; exit 1
fi
exec buzz-deletion submit --host "$host" ...

Prevention

When it happens

Trigger: Invoking a deletion submit command with `--host ""` or `--host " "` — typically an automation script expanding an unset/empty shell variable: `--host "$COMMUNITY_HOST"` where COMMUNITY_HOST is empty in that environment.

Common situations: CI jobs and cron wrappers passing through variables that are conditionally set; .env files where the host line was commented out but the wrapper still forwards the (now empty) value; manual runs pasting a placeholder.

Related errors


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