Chat Patches

Chat Patches

2M Downloads

The ChatLog class is having trouble trying to serialize data - build #442 - 1.21

ZLXL1234 opened this issue · 1 comments

commented

Description

While using the ChatPatches mod, I encountered a fatal error that crashes the game. The error is related to the serialization of chat logs and seems to be caused by certain enchantments not being recognized in the current registry set. The game outputs a JsonParseException followed by a NoSuchElementException

How to reproduce

The last action I took before the game crashed was to open the menu
After that the game reported an error:

[22:04:22] [Render thread/ERROR]: [ChatLog.lambda$serialize$1] /!\ Please report this error on GitHub or Discord with the full log file attached! /!\
com.google.gson.JsonParseException: Element Reference{ResourceKey[minecraft:enchantment / minecraft:mending]=Enchantment 经验修补} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:sweeping_edge]=Enchantment 横扫之刃} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:looting]=Enchantment 抢夺} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:sharpness]=Enchantment 锋利} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:unbreaking]=Enchantment 耐久} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:knockback]=Enchantment 击退} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:fire_aspect]=Enchantment 火焰附加} is not valid in current registry set
	at obro1961.chatpatches.chatlog.ChatLog.lambda$serialize$1(ChatLog.java:192) ~[chatpatches-210.6.6.jar:?]
	at com.mojang.serialization.DataResult$Error.resultOrPartial(DataResult.java:276) ~[datafixerupper-8.0.16.jar:?]
	at obro1961.chatpatches.chatlog.ChatLog.serialize(ChatLog.java:191) ~[chatpatches-210.6.6.jar:?]
	at obro1961.chatpatches.ChatPatches.lambda$onInitializeClient$2(ChatPatches.java:81) ~[chatpatches-210.6.6.jar:?]
	at net.fabricmc.fabric.api.client.screen.v1.ScreenEvents.lambda$static$2(ScreenEvents.java:101) ~[fabric-screen-api-v1-2.0.24+b5597344d1-c4fe1c08eee54b41.jar:?]
	at net.minecraft.class_437.afterInit(class_437.java:1831) ~[client-intermediary.jar:?]
	at net.minecraft.class_437.handler$bie000$fabric-screen-api-v1$afterInitScreen(class_437.java:1784) ~[client-intermediary.jar:?]
	at net.minecraft.class_437.method_25423(class_437.java:318) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1507(class_310.java:1143) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_20539(class_310.java:1721) ~[client-intermediary.jar:?]
	at net.minecraft.class_309.method_1466(class_309.java:451) ~[client-intermediary.jar:?]
	at net.minecraft.class_309.method_22678(class_309.java:499) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.execute(class_1255.java:108) ~[client-intermediary.jar:?]
	at net.minecraft.class_309.method_22676(class_309.java:499) ~[client-intermediary.jar:?]
	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:44) [lwjgl-glfw-3.3.3.jar:?]
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.3.jar:?]
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3438) [lwjgl-glfw-3.3.3.jar:?]
	at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:150) [client-intermediary.jar:?]
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:168) [client-intermediary.jar:?]
	at net.minecraft.class_1041.method_15998(class_1041.java:303) [client-intermediary.jar:?]
	at net.minecraft.class_310.method_1523(class_310.java:1307) [client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:882) [client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:256) [client-intermediary.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480) [fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.16.0.jar:?]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at oolloo.jlw.Wrapper.invokeMain(Wrapper.java:71) [JavaWrapper.jar:?]
	at oolloo.jlw.Wrapper.main(Wrapper.java:51) [JavaWrapper.jar:?]
[22:04:22] [Render thread/ERROR]: Unreported exception thrown!
java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.orElseThrow(Optional.java:377) ~[?:?]
	at obro1961.chatpatches.chatlog.ChatLog.serialize(ChatLog.java:193) ~[chatpatches-210.6.6.jar:?]
	at obro1961.chatpatches.ChatPatches.lambda$onInitializeClient$2(ChatPatches.java:81) ~[chatpatches-210.6.6.jar:?]
	at net.fabricmc.fabric.api.client.screen.v1.ScreenEvents.lambda$static$2(ScreenEvents.java:101) ~[fabric-screen-api-v1-2.0.24+b5597344d1-c4fe1c08eee54b41.jar:?]
	at net.minecraft.class_437.afterInit(class_437.java:1831) ~[client-intermediary.jar:?]
	at net.minecraft.class_437.handler$bie000$fabric-screen-api-v1$afterInitScreen(class_437.java:1784) ~[client-intermediary.jar:?]
	at net.minecraft.class_437.method_25423(class_437.java:318) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1507(class_310.java:1143) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_20539(class_310.java:1721) ~[client-intermediary.jar:?]
	at net.minecraft.class_309.method_1466(class_309.java:451) ~[client-intermediary.jar:?]
	at net.minecraft.class_309.method_22678(class_309.java:499) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.execute(class_1255.java:108) ~[client-intermediary.jar:?]
	at net.minecraft.class_309.method_22676(class_309.java:499) ~[client-intermediary.jar:?]
	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:44) ~[lwjgl-glfw-3.3.3.jar:?]
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.3.jar:?]
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3438) ~[lwjgl-glfw-3.3.3.jar:?]
	at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:150) ~[client-intermediary.jar:?]
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:168) ~[client-intermediary.jar:?]
	at net.minecraft.class_1041.method_15998(class_1041.java:303) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1523(class_310.java:1307) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:882) [client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:256) [client-intermediary.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480) [fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.16.0.jar:?]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at oolloo.jlw.Wrapper.invokeMain(Wrapper.java:71) [JavaWrapper.jar:?]
	at oolloo.jlw.Wrapper.main(Wrapper.java:51) [JavaWrapper.jar:?]
[22:04:22] [Render thread/ERROR]: [ChatLog.lambda$serialize$1] /!\ Please report this error on GitHub or Discord with the full log file attached! /!\
com.google.gson.JsonParseException: Element Reference{ResourceKey[minecraft:enchantment / minecraft:mending]=Enchantment 经验修补} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:sweeping_edge]=Enchantment 横扫之刃} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:looting]=Enchantment 抢夺} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:sharpness]=Enchantment 锋利} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:unbreaking]=Enchantment 耐久} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:knockback]=Enchantment 击退} is not valid in current registry set; Element Reference{ResourceKey[minecraft:enchantment / minecraft:fire_aspect]=Enchantment 火焰附加} is not valid in current registry set
	at obro1961.chatpatches.chatlog.ChatLog.lambda$serialize$1(ChatLog.java:192) ~[chatpatches-210.6.6.jar:?]
	at com.mojang.serialization.DataResult$Error.resultOrPartial(DataResult.java:276) [datafixerupper-8.0.16.jar:?]
	at obro1961.chatpatches.chatlog.ChatLog.serialize(ChatLog.java:191) [chatpatches-210.6.6.jar:?]
	at net.minecraft.class_310.handler$zkg000$chatpatches$saveChatlogOnCrash(class_310.java:26675) [client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:905) [client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:256) [client-intermediary.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480) [fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.16.0.jar:?]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at oolloo.jlw.Wrapper.invokeMain(Wrapper.java:71) [JavaWrapper.jar:?]
	at oolloo.jlw.Wrapper.main(Wrapper.java:51) [JavaWrapper.jar:?]
[22:04:22] [Render thread/ERROR]: Minecraft has crashed!
net.fabricmc.loader.impl.FormattedException: java.util.NoSuchElementException: No value present
	at net.fabricmc.loader.impl.FormattedException.ofLocalized(FormattedException.java:63) ~[fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:482) ~[fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.16.0.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.16.0.jar:?]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at oolloo.jlw.Wrapper.invokeMain(Wrapper.java:71) [JavaWrapper.jar:?]
	at oolloo.jlw.Wrapper.main(Wrapper.java:51) [JavaWrapper.jar:?]
Caused by: java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.orElseThrow(Optional.java:377) ~[?:?]
	at obro1961.chatpatches.chatlog.ChatLog.serialize(ChatLog.java:193) ~[chatpatches-210.6.6.jar:?]
	at net.minecraft.class_310.handler$zkg000$chatpatches$saveChatlogOnCrash(class_310.java:26675) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:905) ~[client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:256) ~[1.21-Fabric.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480) ~[fabric-loader-0.16.0.jar:?]
	... 6 more

Log file link

The crash reports are here:
crash-2024-08-15_11.19.47-client.txt
The full log is here:
latest.log

Expected result

Open the menu

Specs and Details

Required information:

  • Computer OS: Windows 11 22631.3447
  • Mod version:ChatPatches 210.6.6-build #442
  • Fabric version:0.16.0, Fabric API version:0.102.0, YetAnotherConfigLib version:3.5.0
  • Mod Menu version:11.0.1

Optional but suggested information:
Since I'm using a Chinese system, the logs contain Chinese, but it doesn't affect the reading.
chatlog.json
chatpatches.json

commented

even though it's marked as a different issue, this is still related to #180, so i'm going to close this and link it there. thanks for the info, from now on please talk there. i appreciate all the information and logs!