When using an effects_changed advancement that runs a reward function when granted, it can be used to give the player a status effect of an infinite duration when that same effect is given and then cleared beforehand. The status effect is then removed when the player dies.
The bug cannot be reproduced if there are other status effects given to the player in the process.
- Create an effects_changed advancement with a reward function:
- Create a reward function for the advancement:
- Use /effect give @s strength 30 127 to get a Strength effect with the same duration and amplifier as the one in the function.
- Use /effect clear or a Milk Bucket to clear the effect.
→ The effect is cleared and then given again to the player.
- Repeat the previous procedure.
→ The effect is no longer cleared, and a "Target has no effects to remove" error message is shown when using the command.
- Observe the effect when it reaches a duration of 00:00.
→ The effect remains and cannot be cleared even when re-logging the world.
- Use /kill to kill the player.
→ The effect is removed.
A data pack is provided below for easier reproduction.