java.util.NoSuchElementException: Collection is empty.
Fabrieze opened this issue ยท 5 comments
Hello! There seems to be a slight error that causes users to be disconnected from the server on first connect, which works after the second connect. I've gone through the log and it seems to point currently to this mod. Here's the log:
[12:52:47] [Render thread/INFO]: [bclib] Sending hello to server.
[12:52:48] [Netty Play IO Thread #0/ERROR]: Encountered exception while handling in channel with name "cobblemonintegrations:syncevoitemsmessage"
java.util.NoSuchElementException: Collection is empty.
at kotlin.collections.CollectionsKt___CollectionsKt.random(_Collections.kt:560) ~[Cobblemon-fabric-1.4.0+1.20.1.jar:?]
at com.cobblemon.mod.common.api.moves.Moves.getExceptional(Moves.java:92) ~[Cobblemon-fabric-1.4.0+1.20.1.jar:?]
at com.cobblemon.mod.common.api.moves.adapters.MoveTemplateAdapter.deserialize(MoveTemplateAdapter.java:29) ~[Cobblemon-fabric-1.4.0+1.20.1.jar:?]
at com.cobblemon.mod.common.api.moves.adapters.MoveTemplateAdapter.deserialize(MoveTemplateAdapter.java:27) ~[Cobblemon-fabric-1.4.0+1.20.1.jar:?]
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:431) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:391) ~[gson-2.10.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1214) ~[gson-2.10.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1124) ~[gson-2.10.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1034) ~[gson-2.10.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:969) ~[gson-2.10.jar:?]
at com.arcaryx.cobblemonintegrations.net.messages.SyncEvoItemsMessage.(SyncEvoItemsMessage.java:70) ~[cobblemonintegrations-1.20.1-1.0.3.jar:?]
at com.arcaryx.cobblemonintegrations.fabric.FabricNetworkHandler.lambda$registerMessageClient$0(FabricNetworkHandler.java:21) ~[cobblemonintegrations-1.20.1-1.0.3.jar:?]
at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.receive(ClientPlayNetworkAddon.java:98) ~[fabric-networking-api-v1-1.3.10+eeb8eb3677-cd9e8672463c95a.jar:?]
at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.receive(ClientPlayNetworkAddon.java:40) ~[fabric-networking-api-v1-1.3.10+eeb8eb3677-cd9e8672463c95a.jar:?]
at net.fabricmc.fabric.impl.networking.AbstractChanneledNetworkAddon.handle(AbstractChanneledNetworkAddon.java:101) ~[fabric-networking-api-v1-1.3.10+eeb8eb3677-cd9e8672463c95a.jar:?]
at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.handle(ClientPlayNetworkAddon.java:90) ~[fabric-networking-api-v1-1.3.10+eeb8eb3677-cd9e8672463c95a.jar:?]
at net.minecraft.class_634.handler$eii000$fabric-networking-api-v1$handleCustomPayload(class_634.java:3268) ~[client-intermediary.jar:?]
at net.minecraft.class_634.method_11152(class_634.java) ~[client-intermediary.jar:?]
at net.minecraft.class_2658.method_11457(class_2658.java:60) ~[client-intermediary.jar:?]
at net.minecraft.class_2658.method_11054(class_2658.java:8) ~[client-intermediary.jar:?]
at net.minecraft.class_2535.method_10759(class_2535.java:175) ~[client-intermediary.jar:?]
at net.minecraft.class_2535.method_10770(class_2535.java:160) ~[client-intermediary.jar:?]
at net.minecraft.class_2535.channelRead0(class_2535.java:52) ~[client-intermediary.jar:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[netty-codec-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[netty-handler-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.82.Final.jar:?]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.82.Final.jar:?]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.82.Final.jar:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.82.Final.jar:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]`
I've seen this issue posted in the Discord. Do you know if it is triggered by having any specific mods/datapacks, or just Cobblemon + Cobblemon Integrations + JEI (this error appears to be caused by the JEI evolution items sync)?
The latter seems likely, but you might have to cross reference with people who also have the same error.
Our other datapacks are:
Additional Origins
Legendary Encounters
LostMons
MissingMons
And then a few of the vanilla tweak ones, such as multiplayer sleep and spawn/home trigger. It's possible it's conflicting with another cobblemon datapack, but not sure myself.
I can also confirm experiencing the same issue and error on my server. The additional datapacks/mods we have (cobblemon related), are:
Gravelmon
DeCubes MoMons
Lucario Overhaul
MoreMons
Wurmple Pack
Shellos and Gastrodon
SaltMons
Pokemon Fishing
PigeonPack
MysticMons
GenoMons
LostMons
AlolaMons
Cobblemon Loot, Cobblemon Create Compat, Item Balls and Expanded Moveset.
So the only crossover we have with Fabrieze's list is LostMons, though that notably has no effect on items. In fact, of those, the only actual cobblemon pack that messes with items appears to be Gravelmon, which introduces quite a few new evolutionary items. Though I believe I recall my server having the error prior to Gravelmon being in game, which is reinforced by Fabrieze having the issue despite no Gravelmon.
I have this same issue. It prevents me from logging in on first launch like the original poster mentioned. And yes, it connects after that error and trying again. Seems to be client-side only as my server logs show no issues like this, but the client log does.
While I'm still not 100% sure what the issue was (my guess is that the evolutions were being synced after the evo items message is decoded), I found a fix (4c53e58). I delayed the decoding until the data is actually used by JEI, and the evolutions seem to be synced sometime before that. I'll probably look for a better solution at some point, but this should be a good enough fix for now. Will have this out in the next version (1.0.4)