Directory sync: Text connector: "USER/ERROR Index was outside the bounds of the array"

When using directory synchronization with the Text connector you may receive the following error (displayed in the directory sync log):

USER/ERROR Index was outside the bounds of the array.

This error occurs when the users text file contains duplicate usernames or synchronization keys. You have to correct your file generation and relaunch a synchronization.