The bug
Functions in data packs now load before entity tags. This causes errors when loading a data pack for the first time.
To reproduce:
Download the attached datapack
and place in the world file.
/reload
❌ There is an error in the log stating there was an invalid entity.Failed to load function bug:error java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Invalid or unknown entity type 'bug:cat' at position 12: ...y @e[type=<--[HERE] ... Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Invalid or unknown entity type 'bug:cat' at position 12: ...y @e[type=<--[HERE] ...
/reload
one more time, and see that the error doesn't appear.
From this, we can conclude that the function is loading before the tag, as if the tag was invalid, it would be invalid in the function the second time. However, the second time it is not invalid, so therefore it must have been loaded.
Linked issues
is duplicated by 5
Attachments
Comments 2
I can confirm this in multiplayer too, whenever the server is restarted the datapacks need to be reloaded using commands, they aren't working by default anymore.
Edit: The part of our datapack that changes the blocks endermen can pick up doesn't work even after using /reload. The rest of the datapack still works. Everything worked fine in the previous snapshots.
After some testing it appears that this affects all data pack tags. The problem is not that they load after function, they aren't loaded at all initially (on world join or /datapack enable). They are only loaded on a /reload.
MC-186478, which may be a duplicate, describes this behavior.