# Failed restore - You should migrate first?

**URL:** https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971
**Category:** Self-hosting
**Created:** [October 15, 2022, 6:26am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971 "2022-10-15T06:26:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [October 15, 2022, 6:26am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/1 "2022-10-15T06:26:14Z")

</div>

Im trying to move from one server to a new server.

The are having the same edition of discourse:

I get this error

```plaintext
> [2022-10-15 06:12:50] [STARTED]
> [2022-10-15 06:12:50] 'frold' has started the restore!
> [2022-10-15 06:12:50] Marking restore as running...
> [2022-10-15 06:12:50] Making sure /var/www/discourse/tmp/restores/default/2022-10-15-061250 exists...
> [2022-10-15 06:12:50] Copying archive to tmp directory...
> [2022-10-15 06:12:52] Unzipping archive, this may take a while...
> [2022-10-15 06:13:00] Extracting dump file...
> [2022-10-15 06:13:08] Validating metadata...
> [2022-10-15 06:13:08] Current version: 20221004122343
> [2022-10-15 06:13:08] Restored version: 20221014005208
> [2022-10-15 06:13:08] EXCEPTION: You're trying to restore a more recent version of the schema. You should migrate first!
> [2022-10-15 06:13:08] /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'
> /var/www/discourse/script/spawn_backup_restore.rb:23:in `restore'
> /var/www/discourse/script/spawn_backup_restore.rb:36:in `block in <main>'
> /var/www/discourse/script/spawn_backup_restore.rb:4:in `fork'
> /var/www/discourse/script/spawn_backup_restore.rb:4:in `<main>'
> [2022-10-15 06:13:08] Trying to rollback...
> [2022-10-15 06:13:08] There was no need to rollback
> [2022-10-15 06:13:08] Cleaning stuff up...
> [2022-10-15 06:13:08] Removing tmp '/var/www/discourse/tmp/restores/default/2022-10-15-061250' directory...
> [2022-10-15 06:13:09] Marking restore as finished...
> [2022-10-15 06:13:09] Notifying 'frold' of the end of the restore.'

```

Why the migration error? Why two different versions? They should use the same…

**The new server**

 ![Skærmbillede 2022-10-15 kl. 08.19.08](https://global.discourse-cdn.com/meta/original/4X/d/3/d/d3dd4d851fb0cc9dd921c876c41ffe057199144f.png)

**The old server**

 ![Skærmbillede 2022-10-15 kl. 08.23.40](https://global.discourse-cdn.com/meta/original/4X/b/d/5/bd50c045e9ee5293a54b00c0c3362fc74ab74499.png)

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [October 15, 2022, 6:29am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/2 "2022-10-15T06:29:34Z")

</div>

> [@frold](#):
>
> `EXCEPTION: You're trying to restore a more recent version of the schema. You should migrate first`

You should upgrade the recipient system before upgrading

---

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [October 15, 2022, 6:30am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/3 "2022-10-15T06:30:44Z")

</div>

How?

As shown per images it should be the same version

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [October 15, 2022, 6:38am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/4 "2022-10-15T06:38:17Z")

</div>

They are on different commits of beta10 (check the blue text below the installed version)

Just rebuild the recipient instance and then the migration should work.

---

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [October 15, 2022, 6:43am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/5 "2022-10-15T06:43:33Z")

</div>

> [@itsbhanusharma](#):
>
> recipient

The old server: Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-194-generic x86\_64)

The new server: Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-50-generic x86\_64)

Could it be related to that?

I try to rebuild the new server by

```plaintext
cd /var/discourse
./launcher rebuild app

```

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [October 15, 2022, 6:45am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/6 "2022-10-15T06:45:37Z")

</div>

> [@frold](#):
>
> Could it be related to that?

No, host system doesn’t matter.

> [@frold](#):
>
> I try to rebuild the new server by

Yes, that should be enough

---

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [October 15, 2022, 7:01am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/7 "2022-10-15T07:01:21Z")

</div>

It wasnt enough

Im getting the same error ☹

```plaintext
[2022-10-15 06:59:36] [STARTED]
[2022-10-15 06:59:36] 'frold' has started the restore!
[2022-10-15 06:59:36] Marking restore as running...
[2022-10-15 06:59:36] Making sure /var/www/discourse/tmp/restores/default/2022-10-15-065936 exists...
[2022-10-15 06:59:36] Copying archive to tmp directory...
[2022-10-15 06:59:38] Unzipping archive, this may take a while...
[2022-10-15 06:59:46] Extracting dump file...
[2022-10-15 06:59:53] Validating metadata...
[2022-10-15 06:59:53] Current version: 20221004122343
[2022-10-15 06:59:53] Restored version: 20221014005208
[2022-10-15 06:59:53] EXCEPTION: You're trying to restore a more recent version of the schema. You should migrate first!
[2022-10-15 06:59:53] /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'
/var/www/discourse/script/spawn_backup_restore.rb:23:in `restore'
/var/www/discourse/script/spawn_backup_restore.rb:36:in `block in <main>'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `fork'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `<main>'
[2022-10-15 06:59:53] Trying to rollback...
[2022-10-15 06:59:53] There was no need to rollback
[2022-10-15 06:59:53] Cleaning stuff up...
[2022-10-15 06:59:53] Removing tmp '/var/www/discourse/tmp/restores/default/2022-10-15-065936' directory...
[2022-10-15 06:59:54] Marking restore as finished...
[2022-10-15 06:59:54] Notifying 'frold' of the end of the restore...

```

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [October 15, 2022, 7:14am UTC](https://meta.discourse.org/t/failed-restore-you-should-migrate-first/241971/8 "2022-10-15T07:14:19Z")

</div>

You should install the discourse-chat plugin on your new server before restoring.  
That migration belongs to chat, not to discourse core.
