After OH41 migration - can't remove orphan links

Version : 4.1.0 on Raspi4 (Openhabian)
Migration from 3.4.5 to 4.1.0

after migration from OH3.4 to 4.1, some Netatmo Deevices broke for unknow reasons. I had remove and re-add then in Paper UI, which obviously changed UID.
Items are managed in items.files, so i changed items in file to point to new channel UID.

everything is back online but I still see the old links in Paper UI Items and also in Openhab-Console “links list”

I tried to delete/purge them from openhab-cli using “openhab:links orphan purge”, which failed → Could not remove link.
thought i may need to unlink them first and tried “openhab:links unlink itemName thingUID”, which failed with same error.

anyone has an idea how i can get rid of the stale links ?

Just to avoid confusion, proper use of technical terms in OH is important. PaperUI has not existed in OH since OH 2.5. PaperUI was replaced with MainUI in OH 3.0.

When you accept a Thing from the Inbox, you have the option to set the UID before the Thing is created. In the future be sure to change the ID so it matches the old one and you can avoid this problem and reduce the amount of work you need to do.

Double check the permissions on the files under /var/lib/openhab/jsondb.

Try restarting OH and trying again. When I get unspecified errors like this sometimes a restart clears whatever the problem was.

You do not necessarily need to remove the link from the Item first to purge them.

If none of that works, we can remove them manually by editing the JSONDB files manually. But I don’t think it will come to that.