juspay/hyperswitch · error
Couldn't retrieve PostgreSQL connection
Error message
Couldn't retrieve PostgreSQL connection
What it means
Error "Couldn't retrieve PostgreSQL connection" thrown in juspay/hyperswitch.
Source
Thrown at crates/drainer/src/connection.rs:43
) -> PgPool {
let database_url = database.get_database_url(schema);
let manager = async_bb8_diesel::ConnectionManager::<DejaPgConnection>::new(database_url);
let pool = bb8::Pool::builder()
.max_size(database.pool_size)
.connection_timeout(std::time::Duration::from_secs(database.connection_timeout));
pool.build(manager)
.await
.expect("Failed to create PostgreSQL connection pool")
}
#[allow(clippy::expect_used)]
pub async fn pg_connection(
pool: &PgPool,
) -> PooledConnection<'_, async_bb8_diesel::ConnectionManager<DejaPgConnection>> {
pool.get()
.await
.expect("Couldn't retrieve PostgreSQL connection")
}
View on GitHub (pinned to 07df51534c)
Solutions
- Check that the PostgreSQL pool is not exhausted (max connections) and the database is reachable
- Review pool timeout settings and database load
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/drainer/src/connection.rs:43 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of juspay/hyperswitch@07df51534c (2026-08-23).
Data as JSON: /api/errors/f654ccb8b2c78330.
Report an issue: GitHub.