Restore fails due to s3 migration failure

Because it’s just counting flags that came along with the backup. This isn’t the process that actually finds the issues.

Ideally you’d want to clear the missing uploads flags on the old server first, then take a fresh backup.

You can run a task that will list and attempt to repair the missing uploads on the old server (it may take a while)

cd /var/discourse
./launcher enter app
VERBOSE=1 rake posts:missing_uploads

and mark any remaining as ignored if you want to continue

GIVE_UP=1 VERBOSE=1 rake posts:missing_uploads

At that point you can take a new backup and restore it.