We're on 4.25.4. We recently turned on mixed mode replication for GAS, which seems to work fine and reduce bandwidth as expected. However one of our unit tests started failing with this error message:
FMinimapReplicationTagCountMap::RemoveTag called on Tag GameplayEffect.Weapon.Equip.Primary and count is now < 0
Upon investigating, the case in question has a gameplay effect GE_Common_WeaponEquipPrimary being added via ApplyGameplayEffectToSelf which during UpdateTagMap_Internal activates an ability which adds another gameplay effect GE_Common_WeaponEquippedPrimary. The GE_Common_WeaponEquipPrimary effect is added and removed immediately, which leaves the GE_Common_WeaponEquippedPrimary effect on the character.
I attached the callstack where the error "count is now < 0" appears. The problem is in the order in which updates to MinimalReplicationTags are applied via calls to AddTag/RemoveTag:
(outputs error about "FMinimapReplicationTagCountMap::RemoveTag called on Tag GameplayEffect.Weapon.Equip.Primary and count is now < 0", because the next AddTag hasn't happened yet
The order above is attempting to remove a GE which has not been applied yet.
I believe the problem is in FActiveGameplayEffectsContainer::AddActiveGameplayEffectGrantedTagsAndModifiers, where the UpdateTagMap calls happens before the minimal tags have the correct counts. Since UpdateTagMap dispatches arbitrary gameplay code, the minimal tag counts must be correct prior to this call so I've changed the order of operations:
This updates the MinimalReplicationTags in the correct order:
I don't have a great way to reproduce this, other than reading the initial bug and duplicating a similar setup where a GE applies another GE instantly.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-148368 in the post.