It looks like there was more than one user with the same username returned by the LDAP system.
The code that is causing the error is the code that pulls all the usernames from the LDAP system and inserts them into a temporary table, before comparing this list with the existing users already registered with the Moodle site.
I suggest you check the LDAP system to see if there is more than one user with the username (according to the error message) of '010'.