Closed NovaNine closed 2 years ago
Looks like the link to Ancient Tools may have been wrong after all. I got the same error after a clean restart, with AT completely disabled. I generated one world successfully, then exited to menu and generated another and it errored same as above.
Ok. This is code that's running on the server, and shouldn't be. It's a constant problem with this game, due to the way it handles server and client side code.
Could I ask, does this happen when you add the mod to an existing world, or only when you gen a new world?
I've just generated 10 different worlds with your settings, with CC and Ancient Tools enabled. I couldn't get it to crash. However, the bug is an obvious one... it's just very confusing. Harmony isn't loaded on the server at all. The server should never know about that code. This is one of the inconsistencies with the game. When you start a new world, the server and client are somewhat merged, until you log out, and back in again.
Either way, I've added a guard-clause to the patch, to force it to return early if it's ever run on the server. I'll release a hotfix now.
It does happen on a pre-existing world, it also happened on loading a world that worked earlier. So maybe the whole thing is random. Here's what I've done:
Earlier I was able to generate a world (CC+other mods) and played it for an hour. Saved and exited to menu, but did not close the game. Tried to re-enter it, got this error (same mods as when world generated).
I restarted the game and created a test world with just the core "mods" enabled. Gen worked. Saved, exited to menu, re-entered - ok. Saved, exited to menu. Enabled just CC (in addition to "core"). Entered OK. Saved, exited to menu. Changed nothing, error happened.
This should hopefully be fixed in 2.1.2.
Update to 2.1.2 (Hotfix)
Fixed: Rare server crash when generating new single-player worlds.
I've also made a bug report, and API suggestion on the official VS Discord.
Thank you very much! Fix seems 100% after multiple new gens / loads of existing worlds.
Describe the Bug: This issue seems correlated with having both Campaign Cartographer (2.1.1) and Ancient Tools (1.4.0) enabled, however the only exception I see is CC so I am posting it here.
I generate a new world and as it is about to start the game it says
8.3.2022 10:13:09 [Notification] Server stop requested, begin shutdown sequence. Stop reason: Exception thrown by server during startup or process
however, I don't find any exceptions in the server logs, but rather one in the client log which references CC (see below)After this the game is left unable to read the save file until restarted (long wait to see world list, shows as corrupted, but will load after a restart). I suspect an unclosed file handle?
To Reproduce: I'm using single player, 1.16.4 (stable) on Win 10. This happened multiple times when I generated a new world (settings). Happened with both 2.1.0 (yesterday) and 2.1.1 (today)
Though my number of tests was limited, this happened 4/4 times with my full mod list (see below). It happened 1/1 with just Alchemy, CC and Ancient Tools. It happened 2/2 with just CC and Ancient Tools. It did not happen 1/1 with just CC as my only mod. It did not happen 1/1 with my full mod list except Ancient Tools.
The same exception is thrown by CC if I attempt to load one of the failing worlds after I turn off Ancient Tools.
Expected Behaviour: I expect the game to start after world generation.
Additional Context
8.3.2022 10:13:09 [Fatal] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Unable to cast object of type 'Vintagestory.Server.ServerCoreAPI' to type 'Vintagestory.API.Client.ICoreClientAPI'. at ApacheTech.VintageMods.CampaignCartographer.Features.PlayerPins.Patches.PlayerPinsPatches.Patch_PlayerMapLayer_Constructor_Postfix(ICoreAPI api, IWorldMapManager mapsink) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Vintagestory.GameContent.WorldMapManager.OnLoaded() at Vintagestory.Server.ServerEventAPI.OnServerStage(EnumServerRunPhase runPhase) at Vintagestory.Server.ServerMain.EnterRunPhase(EnumServerRunPhase runPhase) at Vintagestory.Server.ServerMain.Launch() at _TRhArnJABwZoV9Vt7Ld2l65Xzgg._55FJfeMcDB5NT6lsb5fDE3bzUPI()
My mod list (ignore the Linux format, I am running the game on Windows 10, just used WSL to copy paste directory content):
Edit: Fixed name of Ancient Tools (initially had typed Primitive Tools)