The "/execute on attacker" command does not target an entity previously targeted by the "/data" command
/execute on attacker will not work if the entity has been previously targeted by the /data command that tick. This problem does not exist in version 1.21.4.
To reproduce:
/tick freeze
/summon iron_golem
- Punch the iron golem
/execute as @n[type=minecraft:iron_golem] on attacker run say yes
You say "yes"/data get entity @n[type=minecraft:iron_golem]
/execute as @n[type=minecraft:iron_golem] on attacker run say yes
Nothing is output
The above situation can also lead to errors in datapacks and command blocks.