Changing a player's post effects can disconnect the player while clientbound/minecraft:post_effects is being encoded.
Steps to reproduce
Add the attached reproduction data pack to a vanilla singleplayer world.
Run
/reload.Run
/function postfx_repro:start.Wait a few seconds.
The data pack initially adds 4096 fixed post-effect identifiers and one toggle identifier.
After setup, it only performs the following once per game tick:
posteffect remove @s postfx_repro:toggle
posteffect add @s postfx_repro:toggle
4096 entries are used because this reproduces the issue consistently on my system. I do not know whether 4096 represents an actual limit.
Expected result
The post effects are updated without disconnecting the player.
Actual result
The player is disconnected while clientbound/minecraft:post_effects is being encoded.
The server log shows:
Error sending packet clientbound/minecraft:post_effects
Caused by:
java.util.ConcurrentModificationException
with:
java.util.ArrayList$Itr.checkForComodification
java.util.ArrayList$Itr.next
net.minecraft.network.codec.ByteBufCodecs$26.encode
Environment
Windows 11, Java 25.0.1, Intel Core i9-10850K, NVIDIA GeForce RTX 3090, Vanilla singleplayer
Thank you for helping us improve Minecraft! We saved your files: