This error cause to have an error occurred querying a data source in InfoPath when trying to query User profile service.
This error is very strange because it is happening only some times. most of the time in the first time.
I found that following workout resolve the problem. in here i change the User profile service running application pool identity to someone who had access in the user profile service sharing.
Following are the steps..
Then go to advanced settings and change the identity.
Make sure the account has accessed in user profile service sharing.
Comments
http://sharepointshah.blogspot.in/2013/01/infopath-error-occurred-querying-data.html