When uploading users via CSV, if any of the courses have a non-manual plugin with the lowest sortorder, Moodle will throw an exception:
throw new coding_exception('invalid enrol instance!');
line 1011 of /lib/enrollib.php: coding_exception thrown
line 717 of /admin/uploaduser.php: call to enrol_plugin->enrol_user()
The problem appears to be that admin/uploaduser.php builds its $manualcache list by assuming that the first element returned from enrol_get_instances() is a manual plugin. However this is not always the case (especially since there is a user interface for reordering enrolment plugins).
It should be fixed to search the list for enrol == 'manual'.