# Rake task for merging users

**URL:** https://meta.discourse.org/t/rake-task-for-merging-users/89086
**Category:** Announcements
**Tags:** new-feature, merge-user
**Created:** [March 1, 2018, 12:56pm UTC](https://meta.discourse.org/t/rake-task-for-merging-users/89086 "2018-03-01T12:56:29Z")
**Posts on this page:** 1
**Showing post:** 48

<div class="post-metadata">

### Author: ![wesochuck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wesochuck/32/108706_2.png) [@wesochuck](https://meta.discourse.org/u/wesochuck)
#### Post date: [December 18, 2019, 5:34pm UTC](https://meta.discourse.org/t/rake-task-for-merging-users/89086/48 "2019-12-18T17:34:40Z")

</div>

So, if you’re using SSO on your site is it not possible to complete the rake merge task? The fine folks over at [Communiteq](https://www.communiteq.com) (formerly DiscourseHosting) say they get this error message:

```
ActiveRecord::RecordNotSaved: Failed to save the new associated primary_email
/var/www/discourse/app/services/user_merger.rb:359:in `delete_source_user'

```

This also causes issues when trying to use the plugin from @Dannii because it looks like his process is trying to do this step first.

Any suggested workarounds for merging users for SSO sites? What we have happen is that a person changes from one organization to another and so they get a new account through the SSO process (they have a new email), but since it is the same person, we’d like to be able to merge the accounts once they’ve established themselves at their new location.

---

_[View the full topic](https://meta.discourse.org/t/rake-task-for-merging-users/89086)._
