Error on attempting to remap links

I’m getting this error when attempting to remap links in my recently moved instance as per Change the domain name or rename your Discourse

root@ehealthforum-nz-syd01-web-only:/var/www/discourse# discourse remap draft.ehealthforum.nz ehealthforum.nz
Rewriting all occurrences of draft.ehealthforum.nz to ehealthforum.nz
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)
YES
Error: ERROR: duplicate key value violates unique constraint “index_post_hotlinked_media_on_post_id_and_url_md5”
DETAIL: Key (post_id, md5(url::text))=(80591,66a0d020b208dc9f8452a5eb9617f6bc) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.

While a bit obscure, this is likely to trip up others. It is similar to this, but has occurred on remapping instead.

It seems to occur on posts with Oneboxes. Of which there are many!

It is going to take us a bit, but we should get this sorted in the next month or so.

1 Like

Would this work / be wise in the meantime? It is causing some pain.

Nope, you need to fix a different table

I’ve got a workaround which has fixed the immediate problem for me. I’ve set up a CNAME record from the ‘old’ URL (which happens to be a subdomain of my new root), and validated it with Let’s Encrypt as per this guide:

Now the broken links at least get the user to the correct place!

I’m a little unclear why I had the problem. An automated remap seemed to occur the first time I restored my backup on my staging instance (before making it live). Subsequent restores didn’t trigger a remap despite the instance URL changing - this confused me, and has let to this current problem.

1 Like

Update, I am sorry, but we are totally swamped at the moment. I am putting pr-welcome on this for now.

1 Like

This error seems to have gone away now. Has it been fixed?

However, I’ve got a new one for remapping! Will report separately.

1 Like