For me the issue was caused by a couple of stale 2FA txns in pg_prepared_xacts which were around seven days old. Rolling them back fixed the issue.