Items linking to https://www.wikidata.org/wiki/Q758891 don't display the label, falling back to show the item ID instead.
Timeboxed: 1 day
Status as of 2022-07-26
We spent some time investigating this, concluded that it doesn’t seem to be a common problem at the moment, and decided to not spend more time on the task, partially due to logging problems (see below). We may return to it in the future.
Any affected item can reliably be fixed by purging the item whose terms are missing with a links update via the API, e.g. using the API sandbox (put the item ID in titles). Any edit will also fix the item. A regular purge using the web interface is not sufficient.
Internally, the problem is that the term store has an incomplete record of the item’s terms. Sometimes, the wbt_item_terms.wbit_term_in_lang_id points at a wbt_term_in_lang row that no longer exists; sometimes, the wbt_term_in_lang.wbtl_text_in_lang_id points at a wbt_text_in_lang row that no longer exists. (See T309445#8055711 for an example of both.) This is probably a race condition between the same terms being removed from one item and added to another item during a merge.
We tried to add some debug logging to investigate this issue (T311307, removed again in T313039), but only with partial success. Some of the log messages mysteriously went missing (see T309445#8055711 and T309445#8072981), even though the associated code was almost certainly still running, which made the investigation difficult, almost futile.
If anyone wants to investigate this further, you can start by going through the recent merges, looking at the history of the target item to see if it’s had any edits since then (if yes, skip it, those edits probably fixed the problem even if it happened), then getting its terms from the API (API sandbox – change the titles and, if necessary, the wbetlanguage) and seeing if any terms are missing.