{"record":{"id":"f654ccb8b2c78330","repo":"juspay/hyperswitch","slug":"couldn-t-retrieve-postgresql-connection","errorCode":null,"errorMessage":"Couldn't retrieve PostgreSQL connection","messagePattern":"Couldn't retrieve PostgreSQL connection","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/drainer/src/connection.rs","lineNumber":43,"sourceCode":") -> 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":25,"sourceCodeEnd":45,"githubUrl":"https://github.com/juspay/hyperswitch/blob/07df51534c2e99de9467e8c83e1785bdf7a706b8/crates/drainer/src/connection.rs#L25-L45","documentation":"Error \"Couldn't retrieve PostgreSQL connection\" thrown in juspay/hyperswitch.","triggerScenarios":"Thrown at crates/drainer/src/connection.rs:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the PostgreSQL pool is not exhausted (max connections) and the database is reachable","Review pool timeout settings and database load"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"07df51534c2e99de9467e8c83e1785bdf7a706b8","analyzedAt":"2026-08-23T00:36:32.882Z","contentChangedAt":"2026-08-23T00:36:32.882Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}