block/buzz · error

Redis pool creation failed: {e}

Error message

Redis pool creation failed: {e}

What it means

deadpool_redis::Config::from_url(REDIS_URL).create_pool() failed while connect_member_services() was wiring up Redis for add-member/remove-member. Pool creation fails at construction time when the URL cannot be parsed into a valid Redis configuration — typically an unsupported scheme, missing/garbled host, or malformed query parameters. Note REDIS_URL defaults to redis://localhost:6379 when unset, so a plain missing variable does NOT trigger this; a present-but-malformed one does. Network reachability is NOT checked here (that surfaces later as a checkout/timeout error), though some URL-level auth/TLS settings are validated eagerly.

Source

Thrown at crates/buzz-admin/src/main.rs:421

    let db = connect_db().await?;

    let relay_keypair = {
        let hex = std::env::var("BUZZ_RELAY_PRIVATE_KEY").map_err(|_| {
            anyhow::anyhow!(
                "BUZZ_RELAY_PRIVATE_KEY is required for add-member/remove-member.\n\
                 The relay must have a stable signing key to publish kind:13534 events."
            )
        })?;
        Keys::parse(&hex).map_err(|e| anyhow::anyhow!("invalid BUZZ_RELAY_PRIVATE_KEY: {e}"))?
    };

    let redis_url =
        std::env::var("REDIS_URL").unwrap_or_else(|_| "redis://localhost:6379".to_string());

    let redis_pool = {
        let cfg = deadpool_redis::Config::from_url(&redis_url);
        cfg.create_pool(Some(deadpool_redis::Runtime::Tokio1))
            .map_err(|e| anyhow::anyhow!("Redis pool creation failed: {e}"))?
    };

    let pubsub = Arc::new(
        PubSubManager::new(&redis_url, redis_pool)
            .await
            .map_err(|e| anyhow::anyhow!("PubSub init failed: {e}"))?,
    );

    Ok((db, pubsub, relay_keypair))
}

async fn connect_db() -> Result<Db> {
    let db_url = std::env::var("DATABASE_URL")
        .unwrap_or_else(|_| "postgres://buzz:buzz_dev@localhost:5432/buzz".to_string());
    let db = Db::new(&DbConfig {
        database_url: db_url,
        ..DbConfig::default()
    })

View on GitHub (pinned to f956e6fe06)

Solutions

  1. Check the exact REDIS_URL value: it must be a redis://host:port or rediss://host:port (TLS) URL, e.g. redis://localhost:6379.
  2. Print and inspect it in the same shell that runs buzz-admin: `echo "$REDIS_URL"` — look for missing scheme, stray quotes, or a pasted postgres:// URL.
  3. Unset the variable to fall back to the redis://localhost:6379 default if that is actually where Redis lives.
  4. If the {e} detail mentions TLS/auth params, fix or remove those query parameters (password goes as redis://:password@host:6379).

Example fix

# before
REDIS_URL=postgres://buzz:buzz_dev@localhost:5432/buzz

# after
REDIS_URL=redis://localhost:6379
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# REDIS_URL must parse as a redis(s) URL before buzz-admin runs
url="${REDIS_URL:-redis://localhost:6379}"
if ! [[ "$url" =~ ^rediss?://[^/]+ ]]; then
  echo "REDIS_URL is not a valid redis:// or rediss:// URL: $url" >&2
  exit 1
fi

Prevention

When it happens

Trigger: REDIS_URL set to a Postgres-style URL (postgres://…), a URL with a typo in the scheme (rediss:/localhost), an empty redis:// with no host plus strict parsing, or an invalid query param appended (e.g. redis://host:6379?foo=bar).

Common situations: Operators pasting DATABASE_URL into the REDIS_URL slot; enabling TLS by writing rediss:// without a valid endpoint; copy-paste truncation of the URL; .env values with unexpanded variables (`redis://$REDIS_HOST:6379` kept literal).

Related errors


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