Thank you Bruce ! As nearly everything in computer science
But to go beyond, I was just wondering if something more directly accessible was existing, like a documentation entry pointing out a button “cleanup” or an automatic cleaning algorithm as a service ?
There is no automatic cleanup service in OH. You’ll have to “manually” remove the erroneous links. Given the REST API that would be scriptable. Or you can open the JSONDB file and manually remove them.
There are times where one may have temporarily removed the Item or temporarily removed the Thing but you do not want to remove the Link. If the Link were removed automatically, for example, you’d have to recreate all of your Links every time you reload a .items file if the links are defined through the UI. So OH takes a bit of a hands off when it comes to cleaning up the links because ultimately, it doesn’t have enough information to tell the difference between a temporarily invalid Link and one that needs to be removed.
I am very surprised by the quantity of invalid links (that I do not want to keep) accumulated from my first installation of openhab2 two years ago. I will go and delete them manually