Same problem here 3.1 - we've resorted to deleting about 10 users at a time and this works the vast majority of the time without getting that error.
My latest 3.1 moodle has problem as well. Related bug https://tracker.moodle.org/browse/MDL-51694
Hi guys! We're using Moodle 3.3 and we are also experiencing this error. Any workaround?
Appreciate the help!