This probably isn’t helpful, but this sounds like where your problem started. It would have been much better to create those users with Rails so that it could do all of the checks on the data when it creates users.
So maybe that’s the step where you broke things.
Is this site live or is it a test site where you can start over? It will be much easier to not break things than to try to figure out what is broken and then how to fix it.
active_model_serializers (0.8.4) lib/active_model/array_serializer.rb:53:in as_json' app/serializers/admin_detailed_user_serializer.rb:166:in similar_users’
(eval):72:in `_fast_attributes’
Maybe that means that you have users with duplicate email addresses?
Edit: I don’t think that’s it.
What I’d recommend is that you look at discourse/script/import_scripts at main · discourse/discourse · GitHub and find a script to base yours on and use such a script to import the data. Unless you have intimate understanding of Rails and Discourse mucking directly with the database is a recipe for disaster.