Whatever the administrator enters in as the "Group name attribute" must be unique for all groups in the LDAP server. Typically this is the "CN" attribute.
In the event that two different entities in LDAP are found with the same value for that attribute (CN), you receive the following stack trace.
Excluding these duplicates from the sync is not possible due to the fact that we can't control the order in which groups are returned from the LDAP server. If the ordering were to change between syncs, the memberships could keep changing on the Confluence side.
The solution to this problem is to amalgamate memberships for groups which share the same name on the remote server. We should make this an option in the LDAP configuration.