block/buzz · error · anyhow::Error

{name} is required for community deletion

Error message

{name} is required for community deletion

What it means

required_env() in buzz-deletion refuses to start when a mandatory variable is unset, empty, or whitespace-only; the message names the offending variable ({name}). The deletion pipeline reads PostgreSQL state and hard-deletes community data across the DB, S3 media, and Redis, so all backing stores must be explicitly configured: DATABASE_URL, BUZZ_S3_ENDPOINT, BUZZ_S3_ACCESS_KEY, BUZZ_S3_SECRET_KEY, BUZZ_S3_BUCKET, and REDIS_URL are required (S3 region defaults to us-east-1; pool sizes are optional). Unlike buzz-admin, there are NO localhost defaults for these — the destructive tool refuses to guess.

Source

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

        "BUZZ_REDIS_POOL_SIZE",
        16,
    )));
    let redis = redis_config
        .create_pool(Some(deadpool_redis::Runtime::Tokio1))
        .context("create deletion Redis pool")?;
    Ok(Services {
        store,
        media,
        redis,
    })
}

fn required_env(name: &str) -> Result<String> {
    std::env::var(name)
        .ok()
        .map(|value| value.trim().to_owned())
        .filter(|value| !value.is_empty())
        .ok_or_else(|| anyhow::anyhow!("{name} is required for community deletion"))
}

fn env_parse<T>(name: &str, default: T) -> T
where
    T: std::str::FromStr,
{
    std::env::var(name)
        .ok()
        .and_then(|value| value.parse().ok())
        .unwrap_or(default)
}

fn validate_frozen_inventory(request: &DeletionRequest) -> Result<FrozenInventory> {
    let frozen: FrozenInventory = serde_json::from_value(
        request
            .inventory_manifest
            .clone()
            .ok_or_else(|| permanent("approved request has no frozen inventory"))?,

View on GitHub (pinned to f956e6fe06)

Solutions

  1. Read the variable name in the message and export it: for community deletion you need DATABASE_URL, REDIS_URL, BUZZ_S3_ENDPOINT, BUZZ_S3_ACCESS_KEY, BUZZ_S3_SECRET_KEY, and BUZZ_S3_BUCKET (BUZZ_S3_REGION/AWS_REGION optional, defaults us-east-1).
  2. Copy the values from the relay's environment — the S3 endpoint/bucket must be the SAME store the relay uploads media to, or deletion will miss blobs.
  3. Re-run after fixing; the check repeats per variable, so fix them in one pass by validating your env file first.
  4. Watch for whitespace-only values in .env files (trailing spaces, quoted empties) — they are treated as missing.

Example fix

# before
export DATABASE_URL=postgres://buzz:buzz_dev@localhost:5432/buzz
buzz-deletion submit --requester npub1... --reason gdpr
# error: BUZZ_S3_ENDPOINT is required for community deletion

# after
export DATABASE_URL=postgres://buzz:buzz_dev@localhost:5432/buzz
export REDIS_URL=redis://localhost:6379
export BUZZ_S3_ENDPOINT=http://localhost:9000
export BUZZ_S3_ACCESS_KEY=minioadmin
export BUZZ_S3_SECRET_KEY=minioadmin
export BUZZ_S3_BUCKET=buzz-media
buzz-deletion submit --requester npub1... --reason gdpr
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# deletion preflight: every required variable present and non-blank
required=(DATABASE_URL REDIS_URL BUZZ_S3_ENDPOINT BUZZ_S3_ACCESS_KEY BUZZ_S3_SECRET_KEY BUZZ_S3_BUCKET)
for name in "${required[@]}"; do
  val="${!name}"
  if [ -z "${val// /}" ]; then echo "$name is required for community deletion" >&2; exit 1; fi
done

Prevention

When it happens

Trigger: Running any buzz-deletion command (submit, approve, run, loop…) with one of the required variables missing — most commonly REDIS_URL or the BUZZ_S3_* group, because operators commonly export only DATABASE_URL. Whitespace-only values ('BUZZ_S3_BUCKET=" "') also trigger it since values are trimmed and checked for emptiness.

Common situations: Deletion executor deployed with the relay's minimal env instead of the full deletion profile; secrets injected only in the relay container, not the CLI/executor environment; commented-out S3 lines in .env after switching media stores; running the CLI locally with only dev DATABASE_URL set.

Related errors


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