After further discussion off-line I found a valid, but rarely seen bug was the cause. Looking in the server logs more information was available. This indicated the error was due to links between the user being deleted and old internal messages.
When the internal messaging system was removed (a year or more ago) I chose to leave the messages table in place in case anyone wanted to retain their old messages. But I also removed the code intended to remove messages from a user about to be deleted. Where those links remain the user cannot be deleted.
So, I have now re-instated the deletion of messages as part of the user delete code. It doesn’t matter if there are no links to messages.
At the same time, I have made another change to fix a very old (PGV) decision. That is, what to do with pending data changes (awaiting admin approval) for a user you want to delete. Currently the code alters those data changes to use admins’ user ID. This means it is no longer possible to know which user actually made the changes.
Now, the system will prevent a user from being deleted if there are pending changes outstanding for that user. You will get a warning message at the same time. In such cases, go ahead and accept/reject their changes in the normal way, then run the user delete again.