Regroup play history can merge unrelated non-live items when legacy rating_key collisions exist
Bug description
Regroup play history can merge unrelated non-live items on long-lived databases where historical rating_key collisions exist.
What I observed
Observed on August 2, 2026 on a long-running Tautulli instance that has survived multiple Plex/library migrations over the years.
After resetting reference_id values to repair a visibly broken group, running Regroup play history recreated the incorrect merge.
Verified example from the database:
- row
2381:Modern Family - Wine Weekend - row
9704:NCIS: Origins - Operazione Tramonto - both rows stored with
rating_key = 8908 - the rows have different
guidvalues - regroup merged them again because it grouped by
user_id + rating_key
Source analysis
In plexpy/activity_processor.py:
regroup_history()iterates all history rows and callsgroup_history()- for non-live media,
group_history()selects the previous rows usinguser_idandrating_key - it then reuses the previous row's
reference_id - it does not validate that non-live rows also share the same
guid
That means a historical rating_key collision can recreate an invalid group even after reference_id is repaired.
Why I think this matters
This seems especially likely on old databases that span years of Plex migrations, metadata changes, or library rebuilds.
In my backup DB, I found:
- 475
rating_keyvalues attached to multiple different titles - 517
rating_keyvalues attached to multiple differentguidvalues - 1909 rows involved in those multi-
guidcollisions
Expected behavior
Regroup play history should not merge non-live rows unless they identify the same underlying item.
Suggested fix
Require matching guid for non-live regrouping before reusing a previous reference_id.
I also prepared a branch with a candidate fix:
vefilippo/Tautullibranchcodex/fix-history-regroup-guid
Source: Tautulli/Tautulli