BDC Issues Resolution: Rare Active Directory Issues in SharePoint

One fine day(or rather not a fine one) we got stuck all of a sudden. We were not able to  perform any activities in SharePoint related to BCS external lists. Every time we tried to browse the lists in central admin we got the following error.

Error: Cannot establish connection to data source. An unexpected internal error occurred in the business data connectivity shared service: the specified user or domain group was not found.

When we browsed through the external list, we found an error "The specified user or domain group was not found". We did some analysis and came to know that we are unable to view the external content types at all. Finally we found that an active directory account (user account) got deleted which was while creating this external content type. This account was used along with two other service accounts under set object permissions. We got this information when we browsed through the table "AR_MetadatObjectSecurity" in the BDC database. We recreated the user account (used the exact user name) and then were able to view the external lists and the set object permissions popup. We then cleaned  the user name from the list of users under object permissions and finally deleted the user from AD.

So the next time you are trying to delete a user who may have been involved in SharePoint administration activities, specifically in setting up BDC you may wanna make sure that his credentials are removed from SharePoint before deleting him from AD.