KubeJS

KubeJS

69M Downloads

java.util.NoSuchElementException: No value present

itsdinkd opened this issue ยท 8 comments

commented

Minecraft Version

1.19.2

KubeJS Version

1902.6.1.build.352

Rhino Version

1902.2.2-build.268

Architectury Version

6.5.85

Forge/Fabric Version

0.14.21

Describe your issue

Getting this weird error that started happening after updating to KJS 6.1

Ever since then REI has been wonky, Forge Hammer from MI doesnt work. REI gets desyncs between client and server when joining servers. Though, I think the REI issue might be unrelated however the Forge Hammer issue shows some odd errors in console when trying to open a forge hammer that relates to tags and this KJS error.

Chief suggested opening a issue to be looked into for making block tags load before recipes

here is the error from server.log.

[10:25:08] [ERROR] ! Error occurred while handling event 'ServerEvents.recipes': java.util.NoSuchElementException: java.util.NoSuchElementException: java.util.NoSuchElementException: No value present
[10:25:08] [ERROR] ! java.util.NoSuchElementException: java.util.NoSuchElementException: java.util.NoSuchElementException: No value present
[10:25:08] [ERROR] ! 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[10:25:08] [ERROR] ! 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
[10:25:08] [ERROR] ! 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[10:25:08] [ERROR] ! 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[10:25:08] [ERROR] ! 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:562)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:591)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask.joinForPoolInvoke(ForkJoinTask.java:1042)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinPool.invoke(ForkJoinPool.java:2639)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.RecipesEventJS.runInParallel(RecipesEventJS.java:649)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.RecipesEventJS.forEachRecipeAsync(RecipesEventJS.java:500)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.RecipesEventJS.remove(RecipesEventJS.java:527)
[10:25:08] [ERROR] ! 	at jdk.internal.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
[10:25:08] [ERROR] ! 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[10:25:08] [ERROR] ! 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.MemberBox.invoke(MemberBox.java:160)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.NativeJavaMethod.call(NativeJavaMethod.java:463)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.Interpreter.interpretLoop(Interpreter.java:1086)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.Interpreter.interpret(Interpreter.java:423)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.InterpretedFunction.call(InterpretedFunction.java:72)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.Context.doTopCall(Context.java:1197)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.ScriptRuntime.doTopCall(ScriptRuntime.java:2619)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.InterpretedFunction.call(InterpretedFunction.java:70)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.ArrowFunction.call(ArrowFunction.java:42)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.InterfaceAdapter.invokeImpl(InterfaceAdapter.java:129)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.InterfaceAdapter.invoke(InterfaceAdapter.java:88)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.rhino.VMBridge.lambda$newInterfaceProxy$0(VMBridge.java:70)
[10:25:08] [ERROR] ! 	at jdk.proxy2/jdk.proxy2.$Proxy110.onEvent(Unknown Source)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.event.EventHandlerContainer.handle(EventHandlerContainer.java:39)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.event.EventHandler.postToHandlers(EventHandler.java:302)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.event.EventHandler.post(EventHandler.java:272)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.event.EventHandler.post(EventHandler.java:226)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.event.EventHandler.post(EventHandler.java:189)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.RecipesEventJS.post(RecipesEventJS.java:302)
[10:25:08] [ERROR] ! 	at net.minecraft.class_1863.handler$emm000$kubejs$customRecipesHead(class_1863.java:12531)
[10:25:08] [ERROR] ! 	at net.minecraft.class_1863.method_20705(class_1863.java)
[10:25:08] [ERROR] ! 	at net.minecraft.class_1863.method_18788(class_1863.java:35)
[10:25:08] [ERROR] ! 	at net.minecraft.class_4080.method_18790(class_4080.java:13)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
[10:25:08] [ERROR] ! 	at net.minecraft.class_4014.method_18365(class_4014.java:69)
[10:25:08] [ERROR] ! 	at net.minecraft.class_156.method_43498(class_156.java:958)
[10:25:08] [ERROR] ! 	at net.minecraft.class_156.method_43499(class_156.java:946)
[10:25:08] [ERROR] ! 	at net.minecraft.server.Main.main(Main.java:156)
[10:25:08] [ERROR] ! 	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
[10:25:08] [ERROR] ! 	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
[10:25:08] [ERROR] ! 	at net.fabricmc.loader.impl.launch.knot.KnotServer.main(KnotServer.java:23)
[10:25:08] [ERROR] ! 	at net.fabricmc.loader.impl.launch.server.FabricServerLauncher.main(FabricServerLauncher.java:69)
[10:25:08] [ERROR] ! Caused by: java.util.NoSuchElementException: java.util.NoSuchElementException: No value present
[10:25:08] [ERROR] ! 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[10:25:08] [ERROR] ! 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
[10:25:08] [ERROR] ! 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[10:25:08] [ERROR] ! 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[10:25:08] [ERROR] ! 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:562)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:591)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:689)
[10:25:08] [ERROR] ! 	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159)
[10:25:08] [ERROR] ! 	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
[10:25:08] [ERROR] ! 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
[10:25:08] [ERROR] ! 	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.RecipesEventJS.lambda$forEachRecipeAsync$10(RecipesEventJS.java:500)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
[10:25:08] [ERROR] ! Caused by: java.util.NoSuchElementException: No value present
[10:25:08] [ERROR] ! 	at java.base/java.util.Optional.get(Optional.java:143)
[10:25:08] [ERROR] ! 	at com.simibubi.create.foundation.recipe.BlockTagIngredient.method_8096(BlockTagIngredient.java:46)
[10:25:08] [ERROR] ! 	at com.simibubi.create.foundation.recipe.BlockTagIngredient.method_8093(BlockTagIngredient.java:68)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.SingleItemMatch.contains(SingleItemMatch.java:15)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.JsonRecipeJS.hasInput(JsonRecipeJS.java:20)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.filter.InputFilter.test(InputFilter.java:15)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.RecipesEventJS$RecipeStreamFilter.test(RecipesEventJS.java:449)
[10:25:08] [ERROR] ! 	at dev.latvian.mods.kubejs.recipe.RecipesEventJS$RecipeStreamFilter.test(RecipesEventJS.java:446)
[10:25:08] [ERROR] ! 	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
[10:25:08] [ERROR] ! 	at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779)
[10:25:08] [ERROR] ! 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[10:25:08] [ERROR] ! 	at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
[10:25:08] [ERROR] ! 	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)
[10:25:08] [ERROR] ! 	... 5 more

Crash report/logs

https://gist.github.com/itsdinkd/04516e03e83554ff16f6444804258e15

commented

Create Fabric is calling an unchecked .get() on an Optional since they expect tags to be updated by the time the Ingredient is dissolved; I can only fix this in an addon (i.e. KubeJS Create) by patching up their test method to work before then as well (since Ingredients might be dissolved during recipe loading by KubeJS or other mods as well)

commented

(Closed since a fix is in development and this is technically the wrong issue tracker)

commented

try disabling allowAsyncStreams in kubejs/config/common.properties

commented

I removed all my scripts, and error went away. However, when I use recipes even for something as simple as

event.remove({output: 'minecraft:apple'})

I will get the error above.

commented

try disabling allowAsyncStreams in kubejs/config/common.properties

Updated my last message, it happens whenever I use remove input/output even on something as basic as a apple

okay trying that now

commented

I still received the error

commented

interestingly enough though when i disabled MatchJsonRecipes, the error disappeared for event.remove input apple. I am attempting this change now with all my scripts in tact.

Edit: not receiving the error anymore when all my scripts are enabled while matchJsonRecipe is set to false.

Does setting this to false break anything?

commented

Thank you max! Should I leave matchJsonRecipes on false in the mean time?