{"record":{"id":"c6d0c368d370c07a","repo":"block/buzz","slug":"pubsub-init-failed-e","errorCode":null,"errorMessage":"PubSub init failed: {e}","messagePattern":"PubSub init failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/buzz-admin/src/main.rs","lineNumber":427,"sourceCode":"                 The relay must have a stable signing key to publish kind:13534 events.\"\n            )\n        })?;\n        Keys::parse(&hex).map_err(|e| anyhow::anyhow!(\"invalid BUZZ_RELAY_PRIVATE_KEY: {e}\"))?\n    };\n\n    let redis_url =\n        std::env::var(\"REDIS_URL\").unwrap_or_else(|_| \"redis://localhost:6379\".to_string());\n\n    let redis_pool = {\n        let cfg = deadpool_redis::Config::from_url(&redis_url);\n        cfg.create_pool(Some(deadpool_redis::Runtime::Tokio1))\n            .map_err(|e| anyhow::anyhow!(\"Redis pool creation failed: {e}\"))?\n    };\n\n    let pubsub = Arc::new(\n        PubSubManager::new(&redis_url, redis_pool)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"PubSub init failed: {e}\"))?,\n    );\n\n    Ok((db, pubsub, relay_keypair))\n}\n\nasync fn connect_db() -> Result<Db> {\n    let db_url = std::env::var(\"DATABASE_URL\")\n        .unwrap_or_else(|_| \"postgres://buzz:buzz_dev@localhost:5432/buzz\".to_string());\n    let db = Db::new(&DbConfig {\n        database_url: db_url,\n        ..DbConfig::default()\n    })\n    .await?;\n    Ok(db)\n}\n\n/// Resolve the deployment's tenant from the configured `RELAY_URL` host.\n///","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/block/buzz/blob/f956e6fe06a76e50cbd8fba1a162482e752e7f1a/crates/buzz-admin/src/main.rs#L409-L445","documentation":"PubSubManager::new(redis_url, pool) failed inside connect_member_services(). Unlike pool creation (which only validates config), PubSubManager establishes the actual Redis pub/sub connection, so this error means the Redis server at REDIS_URL (default redis://localhost:6379) could not be reached or authenticated — connection refused, DNS failure, timeouts, or wrong credentials. The underlying error string is included as {e}.","triggerScenarios":"Running buzz-admin add-member/remove-member while the local Redis container is stopped (`just relay` / docker compose not up), pointing REDAY_URL/REDIS_URL at a remote Redis that is firewalled or requires a password, or a Redis requiring AUTH where the URL has no password.","commonSituations":"Fresh checkout where only Postgres was started; running the admin CLI on a workstation against a staging Redis that needs VPN/TLS; Redis restarted between the relay starting and the admin command; REDIS_URL pointing at a stale container IP.","solutions":["Start Redis and confirm reachability: `redis-cli -u \"$REDIS_URL\" ping` should return PONG before re-running buzz-admin.","If Redis requires auth/TLS, embed credentials in the URL: redis://:password@host:6379 or rediss://… for TLS.","Fix the host/port in REDIS_URL (or unset it to use the localhost:6379 default when running the dev stack via `just relay`).","Check the {e} suffix: 'Connection refused' → Redis not listening on that interface; 'DNS resolution' → wrong hostname; 'AuthenticationError' → missing password/ACL mismatch."],"exampleFix":"# before: redis not running\n$ buzz-admin add-member ...\nerror: PubSub init failed: ... Connection refused (os error 111)\n\n# after: start the dev stack (Postgres + Redis), then retry\n$ just relay &   # or: docker run -p 6379:6379 redis:7\n$ redis-cli ping\nPONG\n$ buzz-admin add-member ...","handlingStrategy":"retry","validationCode":"# preflight: Redis must answer PING before running admin member commands\nredis-cli -u \"${REDIS_URL:-redis://localhost:6379}\" ping >/dev/null 2>&1 \\\n  || { echo \"Redis at ${REDIS_URL:-redis://localhost:6379} is unreachable\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"for attempt in 1 2 3; do buzz-admin add-member ... && break; sleep $((attempt*2)); done # safe to retry: the command fails before mutating state if pubsub init fails","preventionTips":["Run the dev stack via `just relay` so Postgres and Redis come up together.","Health-check Redis (PING) in deployment scripts before any admin operation.","Embed auth in the URL (redis://:pass@host) rather than relying on implicit ACLs."],"tags":["buzz-admin","redis","pubsub","connection-refused","infrastructure"],"backgroundTag":"redis-connection-failed","analyzedSha":"f956e6fe06a76e50cbd8fba1a162482e752e7f1a","analyzedAt":"2026-08-16T22:11:40.750Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}