cpw / inventorysorter

Inventory Sorter
60 stars 46 forks source link

Console Error when stopping server - Cannot get config value before config is loaded #198

Open Soforak opened 1 month ago

Soforak commented 1 month ago

When stopping a server, it always end up with this error in logs which prevents the console to properly end the server.

[11sept.2024 02:06:30.946] [Server thread/DEBUG] [net.neoforged.fml.config.ConfigTracker/CONFIG]: Unloading configs type SERVER
[11sept.2024 02:06:30.947] [Server thread/ERROR] [net.neoforged.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: Cannot get config value before config is loaded.
    Index: 0
    Listeners:
        0: cpw.mods.inventorysorter.InventorySorter$$Lambda/0x00007dc474c36768@76463a3
java.lang.IllegalStateException: Cannot get config value before config is loaded.
    at MC-BOOTSTRAP/com.google.common@32.1.2-jre/com.google.common.base.Preconditions.checkState(Preconditions.java:512)
    at TRANSFORMER/neoforge@21.1.50/net.neoforged.neoforge.common.ModConfigSpec$ConfigValue.getRaw(ModConfigSpec.java:1234)
    at TRANSFORMER/neoforge@21.1.50/net.neoforged.neoforge.common.ModConfigSpec$ConfigValue.get(ModConfigSpec.java:1221)
    at TRANSFORMER/inventorysorter@24.0.5/cpw.mods.inventorysorter.InventorySorter.onConfigLoad(InventorySorter.java:118)
    at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.ConsumerEventHandler.invoke(ConsumerEventHandler.java:26)
    at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:350)
    at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:315)
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.ModContainer.acceptEvent(ModContainer.java:158)
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ModConfig.setConfig(ModConfig.java:79)
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ConfigTracker.closeConfig(ConfigTracker.java:233)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2351)
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ConfigTracker.unloadConfigs(ConfigTracker.java:129)
    at TRANSFORMER/neoforge@21.1.50/net.neoforged.neoforge.server.ServerLifecycleHooks.handleServerStopped(ServerLifecycleHooks.java:136)
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:750)
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:267)
    at java.base/java.lang.Thread.run(Thread.java:1583)

[11sept.2024 02:06:30.948] [Server thread/ERROR] [net.neoforged.fml.ModContainer/LOADING]: Caught exception during event net.neoforged.fml.event.config.ModConfigEvent$Unloading@44ad9a54 dispatch for modid inventorysorter
java.lang.IllegalStateException: Cannot get config value before config is loaded.
    at MC-BOOTSTRAP/com.google.common@32.1.2-jre/com.google.common.base.Preconditions.checkState(Preconditions.java:512) ~[guava-32.1.2-jre.jar%2383!/:?]
    at TRANSFORMER/neoforge@21.1.50/net.neoforged.neoforge.common.ModConfigSpec$ConfigValue.getRaw(ModConfigSpec.java:1234) ~[neoforge-21.1.50-universal.jar%23123!/:?]
    at TRANSFORMER/neoforge@21.1.50/net.neoforged.neoforge.common.ModConfigSpec$ConfigValue.get(ModConfigSpec.java:1221) ~[neoforge-21.1.50-universal.jar%23123!/:?]
    at TRANSFORMER/inventorysorter@24.0.5/cpw.mods.inventorysorter.InventorySorter.onConfigLoad(InventorySorter.java:118) ~[inventorysorter-1.21-24.0.5.jar%23124!/:24.0.5]
    at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.ConsumerEventHandler.invoke(ConsumerEventHandler.java:26) ~[bus-8.0.1.jar%2367!/:?]
    at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:350) ~[bus-8.0.1.jar%2367!/:?]
    at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:315) ~[bus-8.0.1.jar%2367!/:?]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.ModContainer.acceptEvent(ModContainer.java:158) ~[loader-4.0.24.jar%2360!/:4.0]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ModConfig.setConfig(ModConfig.java:79) ~[loader-4.0.24.jar%2360!/:4.0]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ConfigTracker.closeConfig(ConfigTracker.java:233) ~[loader-4.0.24.jar%2360!/:4.0]
    at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
    at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2351) ~[?:?]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ConfigTracker.unloadConfigs(ConfigTracker.java:129) ~[loader-4.0.24.jar%2360!/:4.0]
    at TRANSFORMER/neoforge@21.1.50/net.neoforged.neoforge.server.ServerLifecycleHooks.handleServerStopped(ServerLifecycleHooks.java:136) ~[neoforge-21.1.50-universal.jar%23123!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:750) ~[server-1.21.1-20240808.144430-srg.jar%23122!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:267) ~[server-1.21.1-20240808.144430-srg.jar%23122!/:?]
    at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
[11sept.2024 02:06:30.949] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: Uncaught exception in server thread
net.neoforged.fml.ModLoadingException: Loading errors encountered:
    - Simple Inventory Sorter (inventorysorter) encountered an error while dispatching the net.neoforged.fml.event.config.ModConfigEvent$Unloading event
      java.lang.IllegalStateException: Cannot get config value before config is loaded.

    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.ModContainer.acceptEvent(ModContainer.java:162) ~[loader-4.0.24.jar%2360!/:4.0]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ModConfig.setConfig(ModConfig.java:79) ~[loader-4.0.24.jar%2360!/:4.0]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ConfigTracker.closeConfig(ConfigTracker.java:233) ~[loader-4.0.24.jar%2360!/:4.0]
    at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
    at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2351) ~[?:?]
    at MC-BOOTSTRAP/fml_loader@4.0.24/net.neoforged.fml.config.ConfigTracker.unloadConfigs(ConfigTracker.java:129) ~[loader-4.0.24.jar%2360!/:4.0]
    at TRANSFORMER/neoforge@21.1.50/net.neoforged.neoforge.server.ServerLifecycleHooks.handleServerStopped(ServerLifecycleHooks.java:136) ~[neoforge-21.1.50-universal.jar%23123!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:750) ~[server-1.21.1-20240808.144430-srg.jar%23122!/:?]
    at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:267) ~[server-1.21.1-20240808.144430-srg.jar%23122!/:?]
    at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
penturt commented 1 month ago

Having the same issue. Was just about to open an issue with the same error message.

MiThors commented 1 month ago

Same here, anyone found a solution?

Phax3 commented 3 weeks ago

Having the same issue on Direwolf20 1.21 latest.log

penturt commented 5 days ago

Can't properly schedule server restarts due to this error just causing server shutdown to hang.

DoomSquirter commented 1 day ago

same. Dealing with other bugs not related to this and it's causing lots of issues when that bug crashes server and it just halts instead. would be super great if there was a fix to this.