Fixed a strange bug that existed for many, many years

The shop software is really complex.
We don’t write it outself.
It does contain some bugs and that will always be the case to some extend.

The issue

Given that products with their many properties to support filtering, searching, categories, multiple languages, … are complex, we often copy an existing product to create a new one.
Many years ago we noticed an issue with URL redirects of copied products conflicting with the product that was originally copied. Even as both are supposed to have different URLs.

The cause

That visible issue exists for many people and can have dozens of possible reasons.
So finally, after all these years, we stumbled across the reason it existed for us.
Every product has a url_key. That is unique and gets changed automatically by appending „-1“ when copying a product.
It turns out, that a second, invisible property „url_path“ existed. It was not shown or mentioned anywhere at all.
For a limited time in the past, there was a bug.
When copying a product, this invisible property was not changed.
The resulting duplicates created the error messages.
So finally we knew what to look for and could find all affected products with a complex database query. To not risk breaking anything, we fixed every broken product manually in the database instead of deleting the entire table and have it be reindexed automatically.