mojira.dev
MC-305996

"execute if items ..." can cause server to fail to load function during start

noted that two functions refused to load during server boot up, issuing a /reload fixes the issue similarly to MC-305698

The logs show

17:25:12] [ServerMain/ERROR] (ServerFunctionLibrary) Failed to load function evo:update_egg

java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Expected literal # at position 39: ...ntainer.0 <--[HERE]
	at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:359)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:364)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1791)
	at net.minecraft.server.packs.resources.ProfiledReloadInstance.lambda$profiledExecutor$1(ProfiledReloadInstance.java:58)
	at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$prepareTasks$1(SimpleReloadInstance.java:51)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1750)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1742)
	at java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1659)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Expected literal # at position 39: ...ntainer.0 <--[HERE]
	at net.minecraft.commands.functions.CommandFunction.fromLines(CommandFunction.java:80)
	at net.minecraft.server.ServerFunctionLibrary.lambda$reload$3(ServerFunctionLibrary.java:85)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1789)
	... 9 more
[17:25:12] [ServerMain/ERROR] (ServerFunctionLibrary) Failed to load function evo:inventory_update

java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 4: Expected literal # at position 39: ...ntainer.* <--[HERE]
	at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:359)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:364)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1791)
	at net.minecraft.server.packs.resources.ProfiledReloadInstance.lambda$profiledExecutor$1(ProfiledReloadInstance.java:58)
	at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$prepareTasks$1(SimpleReloadInstance.java:51)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1750)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1742)
	at java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1659)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 4: Expected literal # at position 39: ...ntainer.* <--[HERE]
	at net.minecraft.commands.functions.CommandFunction.fromLines(CommandFunction.java:80)
	at net.minecraft.server.ServerFunctionLibrary.lambda$reload$3(ServerFunctionLibrary.java:85)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1789)
	... 9 more

I didn’t catch this the last time, because I thought the line offset might have been off and dismissed it as the same issue

inventory_update.mcfunction

Find untagged enchanted items
execute if items entity @s container.* #evo:enchantable[!minecraft:enchantments={},!minecraft:custom_data~{tagged:true}] run function evo:update_items
# Find unfixed spawn eggs
execute if items entity @s container.* minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run function evo:update_egg
execute if items entity @s weapon.offhand minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run function evo:update_egg
advancement revoke @s only evo:inventory_trigger

but looking at the update_egg.mcfunction

execute if items entity @s container.0 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.0
execute if items entity @s container.1 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.1
execute if items entity @s container.2 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.2
execute if items entity @s container.3 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.3
execute if items entity @s container.4 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.4
execute if items entity @s container.5 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.5
execute if items entity @s container.6 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.6
execute if items entity @s container.7 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.7
execute if items entity @s container.8 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.8
execute if items entity @s container.9 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.9
execute if items entity @s container.10 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.10
execute if items entity @s container.11 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.11
execute if items entity @s container.12 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.12
execute if items entity @s container.13 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.13
execute if items entity @s container.14 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.14
execute if items entity @s container.15 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.15
execute if items entity @s container.16 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.16
execute if items entity @s container.17 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.17
execute if items entity @s container.18 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.18
execute if items entity @s container.19 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.19
execute if items entity @s container.20 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.20
execute if items entity @s container.21 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.21
execute if items entity @s container.22 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.22
execute if items entity @s container.23 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.23
execute if items entity @s container.24 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.24
execute if items entity @s container.25 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.25
execute if items entity @s container.26 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.26
execute if items entity @s container.27 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.27
execute if items entity @s container.28 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.28
execute if items entity @s container.29 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.29
execute if items entity @s container.30 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.30
execute if items entity @s container.31 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.31
execute if items entity @s container.32 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.32
execute if items entity @s container.33 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.33
execute if items entity @s container.34 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.34
execute if items entity @s container.35 minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value container.35
execute if items entity @s weapon.offhand minecraft:allay_spawn_egg[!minecraft:custom_data~{fixed:true}] run data modify storage evo slot set value weapon.offhand

execute if data storage evo slot run function evo:update_spawn_egg
data remove storage evo slot

looking through all my other random projects it seems the unique thing about those files are those are the only places where I use the tilde functionality

attempting to verify my assumption proved me wrong;

creating a datapack with a function that is just

execute if items entity @s contents minecraft:acacia_boat[!minecraft:attack_range~{}] run say foo

does not fail to load during start up, nor does it with !minecraft:custom_data~{} or with !minecraft:custom_data~{fixed:true}

but it does fail if I use allay_spawn_egginstead of acacia_boat.

So to reproduce, make a datapack with one function;

execute if items entity @s contents minecraft:allay_spawn_egg[!minecraft:attack_range~{}] run say foo

function fails to load when server starts up, /reload makes the function available.

Comments 1

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Could you please attach a datapack showcasing the issue?

Just a reminder, to make your bug report as effective as possible, please try and include the following steps to reproduce the problem:

Steps to Reproduce:
1.
2.
3.

Observed Results:
(Briefly describe what happens)

Expected Results:
(Briefly describe what should happen)

If your ticket does not look like the example given here, then it's likely to be closed as incomplete.

This ticket will automatically reopen when you reply. Thanks!

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

knirch

(Unassigned)

Unconfirmed

(Unassigned)

26.1 Snapshot 5

Retrieved