# Migration failed: relation "user\_required\_fields\_versions" already exists

**URL:** <https://meta.discourse.org/t/migration-failed-relation-user-required-fields-versions-already-exists/325378>\
**Category:** Self-hosting\
**Tags:** unsupported-install\
**Created:** [September 6, 2024, 9:16pm UTC](https://meta.discourse.org/t/migration-failed-relation-user-required-fields-versions-already-exists/325378 "2024-09-06T21:16:58Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Clo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/clo/32/372138_2.png) [@Clo](https://meta.discourse.org/u/Clo)\
**Post date:** [September 7, 2024, 6:55pm UTC](https://meta.discourse.org/t/migration-failed-relation-user-required-fields-versions-already-exists/325378/13 "2024-09-07T18:55:06Z")

</div>

Ok I tried to restore the previous backup from the command line following those instructions and it gave me this:

```plaintext
Enabling restore...
Restore are now permitted. Disable them with `disable_restore`
root@hub-app:/var/www/discourse# discourse restore sadocs-hub-2024-09-06-202428-v20240827064121.tar.gz
Starting restore: sadocs-hub-2024-09-06-202428-v20240827064121.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2024-09-07-185238 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
Extracting dump file...
Validating metadata...
  Current version: 20240528144216
  Restored version: 20240827064121
EXCEPTION: You're trying to restore a more recent version of the schema. You should migrate first!
/var/www/discourse/lib/backup_restore/meta_data_handler.rb:31:in `validate'
/var/www/discourse/lib/backup_restore/restorer.rb:112:in `validate_backup_metadata'
/var/www/discourse/lib/backup_restore/restorer.rb:43:in `run'
script/discourse:157:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.2/lib/thor/base.rb:584:in `start'
script/discourse:291:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:451:in `exec'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.9/exe/bundle:28:in `block in <top (required)>'
/usr/local/lib/ruby/site_ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.9/exe/bundle:20:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
There was no need to rollback
Cleaning stuff up...
Removing tmp '/var/www/discourse/tmp/restores/default/2024-09-07-185238' directory...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.
root@hub-app:/var/www/discourse# exit
logout

```

I then tried ./launcher start app but it still gives the Error 500 page.

Why does it tell me to migrate first?

---

_[View the full topic](https://meta.discourse.org/t/migration-failed-relation-user-required-fields-versions-already-exists/325378)._
