{"record":{"id":"38028323b7205f06","repo":"block/buzz","slug":"redis-pool-creation-failed-e-380283","errorCode":null,"errorMessage":"Redis pool creation failed: {e}","messagePattern":"Redis pool creation failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/buzz-relay/src/main.rs","lineNumber":373,"sourceCode":"    let audit = if config.audit_enabled {\n        let audit_pool = sqlx::postgres::PgPoolOptions::new()\n            .max_connections(5)\n            .min_connections(1)\n            .connect(&config.database_url)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Audit DB connection failed: {e}\"))?;\n        info!(\"Audit service ready\");\n        Some(AuditService::new(audit_pool))\n    } else {\n        info!(\"Audit logging disabled by BUZZ_AUDIT_ENABLED\");\n        None\n    };\n\n    let redis_pool = {\n        let mut cfg = deadpool_redis::Config::from_url(&config.redis_url);\n        cfg.pool = Some(deadpool_redis::PoolConfig::new(config.redis_pool_size));\n        cfg.create_pool(Some(deadpool_redis::Runtime::Tokio1))\n            .map_err(|e| anyhow::anyhow!(\"Redis pool creation failed: {e}\"))?\n    };\n    let redis_health_pool = redis_pool.clone(); // cheap Arc clone — shared with readiness handler\n    let pubsub = Arc::new(\n        PubSubManager::new(&config.redis_url, redis_pool)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"PubSub init failed: {e}\"))?,\n    );\n    info!(\"Redis pub/sub connected\");\n\n    // Spawn Redis pub/sub subscriber for multi-node fan-out.\n    // Events published by other relay instances are received here and\n    // fanned out to local WebSocket subscribers.\n    let pubsub_for_sub = Arc::clone(&pubsub);\n    tokio::spawn(async move { pubsub_for_sub.run_subscriber().await });\n\n    // Spawn Redis pub/sub subscriber for cross-pod cache-key invalidation.\n    // Membership / visibility changes on other pods are received here and the\n    // matching local moka caches are dropped (via the consumer loop below).","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/block/buzz/blob/f956e6fe06a76e50cbd8fba1a162482e752e7f1a/crates/buzz-relay/src/main.rs#L355-L391","documentation":"deadpool-redis builds the application Redis pool from REDIS_URL with the configured redis_pool_size. create_pool validates the URL/config synchronously — failure means the URL could not be parsed into a valid Redis configuration (bad scheme, malformed host/port) — and startup aborts.","triggerScenarios":"REDIS_URL missing the scheme (`localhost:6379` instead of `redis://localhost:6379`), an unsupported scheme, or otherwise malformed URL characters.","commonSituations":"Env templating strips or mangles the scheme; a port pasted into the URL field; values carried between environments by hand.","solutions":["Set REDIS_URL to a full URL: redis://host:6379 (or rediss:// for TLS)","Add auth or DB index inline when needed: redis://:password@host:6379/0","Lint the URL in the deploy pipeline before starting the relay"],"exampleFix":"# before\nREDIS_URL=localhost:6379\n\n# after\nREDIS_URL=redis://redis:6379","handlingStrategy":"validation","validationCode":"# REDIS_URL must parse as a Redis URL.\n[[ \"${REDIS_URL:-}\" =~ ^rediss?://[^/]+ ]] || { echo 'REDIS_URL must start with redis:// or rediss://'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the redis:// or rediss:// scheme in REDIS_URL","Validate the URL shape in CI env linting","Prefer rediss:// for managed Redis requiring TLS"],"tags":["redis","config","env-vars","startup","deadpool"],"backgroundTag":"invalid-redis-url","analyzedSha":"f956e6fe06a76e50cbd8fba1a162482e752e7f1a","analyzedAt":"2026-08-16T22:11:40.750Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}