# Rake users:merge fails to delete user with small posts

**URL:** https://meta.discourse.org/t/rake-users-merge-fails-to-delete-user-with-small-posts/106827
**Category:** Bug
**Tags:** merge-user
**Created:** [17.Январь.2019 17:21:22 UTC](https://meta.discourse.org/t/rake-users-merge-fails-to-delete-user-with-small-posts/106827 "2019-01-17T17:21:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [17.Январь.2019 17:21:22 UTC](https://meta.discourse.org/t/rake-users-merge-fails-to-delete-user-with-small-posts/106827/1 "2019-01-17T17:21:22Z")

</div>

When attempting to merge users accounts, twice now the merge has failed to complete properly as the user has small posts which are not deleted. In both cases I’ve encountered the small posts were invites in an email, meaning the user CC’d others when writing an email.

Error:

```plaintext
rake users:merge['user_A','user_B']
rake aborted!
UserDestroyer::PostsExistError: UserDestroyer::PostsExistError
/var/www/discourse/app/services/user_destroyer.rb:18:in `destroy'
/var/www/discourse/app/services/user_merger.rb:360:in `delete_source_user'
/var/www/discourse/app/services/user_merger.rb:22:in `merge!'
/var/www/discourse/lib/tasks/users.rake:48:in `block in <top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => users:merge
(See full trace by running task with --trace)

```

cc @gerhard

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [19.Январь.2019 12:44:17 UTC](https://meta.discourse.org/t/rake-users-merge-fails-to-delete-user-with-small-posts/106827/4 "2019-01-19T12:44:17Z")

</div>

This was a regression. It’s fixed.

[https://github.com/discourse/discourse/commit/f8ded9cec9255a297d988b821dc596e133d86d78](https://github.com/discourse/discourse/commit/f8ded9cec9255a297d988b821dc596e133d86d78)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [19.Январь.2019 12:44:26 UTC](https://meta.discourse.org/t/rake-users-merge-fails-to-delete-user-with-small-posts/106827/5 "2019-01-19T12:44:26Z")

</div>


