egebilecen / PZServerDiscordBot

A Project Zomboid Discord Bot written in C# using Discord.NET to manage and execute commands on Project Zomboid Server.
GNU General Public License v3.0
61 stars 11 forks source link

[BUG] Bot continously warning for deleted/removed workshop mod #128

Closed nofurthur closed 5 months ago

nofurthur commented 5 months ago

Describe the bug Preface by saying that this may be user error as I am not sure if there is a file I can update to fix this. Apologies in advance if I am overlooking something obvious.

Our group had previously used the bot to successfully host a Zomboid server approximately 6 months ago. We stopped playing for a period of time, and in the interim one of the workshop mods that we installed was deleted/removed from the Steam workshop by either the Author or Steam without a replacement being added.

This week, we decided to start a different server on a standalone map. Before hosting dedicated with the bot, we locally test hosted in order to verify some changes we made were working.

Locally, a new server config was generated by cloning the old config in-game to retain some custom settings, renaming, reordering and removing old or incompatible mods (including the deleted mod), and then test hosting through the game client. Noting specifically that a reference to the deleted mod was present in the mod list, but AFAIK was deleted prior to initializing the new server for the first time (though I am not 100% certain).

Once testing was complete, we initialized the dedicated server by pointing the server.bat file in PZDedicated folder to the new host configuration name, and then launching via the PZServerDIscordBot.exe (latest ver).

Everything initialized fine and has been running smoothly save for one error. On the Workshop Mod update check interval, the bot throws a "Result code 9" error as it cannot locate info on the deleted workshop item. This happens on every interval.

To Reproduce I am uncertain if this is easily reproducible as it may require a mod be downloaded from the workshop, added to a server config, and then de-listed from the workshop while remaining in at least part of the server config.

Expected behavior Would like to be able to stop this error from happening

Screenshots Screenshot of the error that happens at checkin

Screenshot 2024-01-22 140727

Additional context In both the Project Zomboid Dedicated Server folder, and my local users/Zomboid folder I found references to the removed mod in the folder steamapps/workshop file appworkshop_108600.acf, as well as the files for the mod itself under workshop/content/. I removed these references and deleted the associated files, but this did not resolve the error.

Additionally, our server ini file does not reference the deleted mod.

If there is a file I can specifically modify related to the workshop update check process, please let me know.

egebilecen commented 5 months ago

Hello, before delving into the issue, thank you very much for your support.

Now as for the issue, bot directly reads the workshop mods from the ini file located in %USERPROFILE%\Zomboid\Server folder unless you override this path using -Duser.home=<new folder path> argument in the server bat file. Which in that case, the folder path in the argument would be used. Can you double check if you are checking the right ini file and can you be sure that workshop ID of the mod is not in this file?

Also, it is possible to disable non-public mod logging (which is the error you show in the picture) using !toggle_non_public_mod_logging but this is of course just a workaround.

Just leavıng this as a heads up as well, this error doesn't actually prevent workshop mod checker to correctly work. It merely warns the server owner that server won't be restarted if these mods gets updated because bot can't fetch the details.

nofurthur commented 5 months ago

Thanks for the reply!

Confirming -Duser argument is not being used. Also confirming that the .ini file in %USERPROFILE%\Zomboid\Server does not contain the ID of the mod (nor the name under mod load order).

Have temporarily disabled the logging as well. Let me know if there are any files I should share.

egebilecen commented 5 months ago

This is really interesting. Are there multiple *.ini files in the %USERPROFILE%\Zomboid\Server directory by the way? If there are, probably one of them has it and bot uses the ini file instead of correct one.

nofurthur commented 5 months ago

Yes, checked one of the other *.ini files in that folder and it contained the mod ID of the mod in question. Removed the mod ID from that file and the error appears to have gone away.

egebilecen commented 5 months ago

If you are not running multiple servers, I’d recommend you to remove other .ini files or at least rename them to .ini.bak or something so bot won’t use wrong config file.

nofurthur commented 5 months ago

What I ended up doing was moving the currently unused server files to an "Archive" subfolder which seems to have worked