{"record":{"id":"147b8f66d84fc008","repo":"juspay/hyperswitch","slug":"failed-to-create-postgresql-connection-pool","errorCode":null,"errorMessage":"Failed to create PostgreSQL connection pool","messagePattern":"Failed to create PostgreSQL connection pool","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/drainer/src/connection.rs","lineNumber":34,"sourceCode":"// TODO: use stores defined in storage_impl instead\n/// # Panics\n///\n/// Will panic if could not create a db pool\n#[allow(clippy::expect_used)]\npub async fn diesel_make_pg_pool(\n    database: &Database,\n    _test_transaction: bool,\n    schema: &str,\n) -> PgPool {\n    let database_url = database.get_database_url(schema);\n    let manager = async_bb8_diesel::ConnectionManager::<DejaPgConnection>::new(database_url);\n    let pool = bb8::Pool::builder()\n        .max_size(database.pool_size)\n        .connection_timeout(std::time::Duration::from_secs(database.connection_timeout));\n\n    pool.build(manager)\n        .await\n        .expect(\"Failed to create PostgreSQL connection pool\")\n}\n\n#[allow(clippy::expect_used)]\npub async fn pg_connection(\n    pool: &PgPool,\n) -> PooledConnection<'_, async_bb8_diesel::ConnectionManager<DejaPgConnection>> {\n    pool.get()\n        .await\n        .expect(\"Couldn't retrieve PostgreSQL connection\")\n}\n","sourceCodeStart":16,"sourceCodeEnd":45,"githubUrl":"https://github.com/juspay/hyperswitch/blob/07df51534c2e99de9467e8c83e1785bdf7a706b8/crates/drainer/src/connection.rs#L16-L45","documentation":"Error \"Failed to create PostgreSQL connection pool\" thrown in juspay/hyperswitch.","triggerScenarios":"Thrown at crates/drainer/src/connection.rs:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify PostgreSQL is running and reachable and that the drainer database URL/credentials are correct"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"07df51534c2e99de9467e8c83e1785bdf7a706b8","analyzedAt":"2026-08-19T10:36:43.745Z","contentChangedAt":"2026-08-19T10:36:43.745Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}