{"record":{"id":"a75fa7092bef5d43","repo":"block/buzz","slug":"redis-pool-creation-failed-e","errorCode":null,"errorMessage":"Redis pool creation failed: {e}","messagePattern":"Redis pool creation failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/buzz-admin/src/main.rs","lineNumber":566,"sourceCode":"    let db = connect_db().await?;\n\n    let relay_keypair = {\n        let hex = std::env::var(\"BUZZ_RELAY_PRIVATE_KEY\").map_err(|_| {\n            anyhow::anyhow!(\n                \"BUZZ_RELAY_PRIVATE_KEY is required for add-member/remove-member.\\n\\\n                 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(\n        &DbConfig {\n            database_url: db_url,\n            ..DbConfig::default()","sourceCodeStart":548,"sourceCodeEnd":584,"githubUrl":"https://github.com/block/buzz/blob/ef2aa1ae38fadcc0bc22b8bf6ed96b35933146be/crates/buzz-admin/src/main.rs#L548-L584","documentation":"deadpool_redis::Config::from_url(&redis_url).create_pool() validates the REDIS_URL string and pool settings; it does not open a network connection. It fails when the URL is not a parseable redis URL — missing the redis:// scheme, an unparseable port, a bogus query parameter, or an entirely empty/garbage value (the default fallback is redis://localhost:6379, so hitting this means REDIS_URL was explicitly set to something invalid).","triggerScenarios":"REDAY_URL/REDIS_URL set to 'localhost:6379' (no scheme), 'redis://localhost:notaport', or containing a trailing newline/space from CI secrets.","commonSituations":"Docker/k8s env values copied without the scheme; port typos; interpolated secrets with whitespace; using a keydb/valkey URL with unsupported params.","solutions":["Set the scheme explicitly: REDIS_URL=redis://localhost:6379 (rediss:// for TLS).","In docker-compose, point at the service name: REDIS_URL=redis://redis:6379.","Check for trailing whitespace/newlines: printf '%s' \"$REDIS_URL\" | od -c | head.","Remove unsupported query params or fix them to deadpool-redis's expected format."],"exampleFix":"# before\nexport REDIS_URL=localhost:6379        # no scheme -> Redis pool creation failed\n# after\nexport REDIS_URL=redis://localhost:6379","handlingStrategy":"validation","validationCode":"# require an explicit scheme before running admin commands\ncase \"$REDIS_URL\" in\n  redis://*|rediss://*) ;;\n  \"\") ;; # default localhost fallback is valid\n  *) echo \"REDIS_URL must start with redis:// or rediss:// — got: $REDIS_URL\" >&2; exit 3 ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize REDIS_URL values in one place (docker-compose / helm values) and reference it everywhere.","Always include the scheme in examples and docs so 'host:port' never gets pasted as-is.","Lint CI env files for REDIS_URL pattern ^rediss?://."],"tags":["buzz-admin","redis","deadpool","connection-url","configuration"],"backgroundTag":"invalid-redis-url","analyzedSha":"ef2aa1ae38fadcc0bc22b8bf6ed96b35933146be","analyzedAt":"2026-08-20T04:38:24.874Z","contentChangedAt":"2026-08-20T04:38:24.874Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}