
Syntax in quark-common.toml file possibly causing Forge and NeoForge crashes
ratemisia opened this issue ยท 2 comments
If I'm correct on this issue, it may fix #5062 and #5046, and possibly several other issues.
See addendum below - the theory in this first post was likely wrong.
In Quark's quark-common.toml settings file, you use some unique syntax to show ranges of numbers in comments:
#Allowed values: [0,)
As a programmer, I understand why you wrote number ranges this way. I also know that these brackets are in comments, and as such should not affect the compilation of your settings file. Unfortunately, it looks like Forge detects a syntax error in your common.toml file, which results in (or is otherwise instantly succeeded by) an ultimately fatal error on mod loading:
[15:58:51] [modloading-worker-0/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Configuration file /home/********/.local/share/PrismLauncher/instances/Fennec Indev/minecraft/config/quark-common.toml is not correct. Correcting
[15:58:51] [modloading-worker-0/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Failed to create mod instance. ModID: quark, class org.violetmoon.quark.base.Quark
java.lang.ArrayIndexOutOfBoundsException: Index 362 out of bounds for length 0
I suspect that the use of brackets in comments may be falsely "corrected" by Forge, which may involve adding opening and closing brackets outside of your comments - resulting in syntax errors that ultimately crash the game.
This crash, as demonstrated in #5062, can happen even with the default config or even when the config has only been edited from the in-game menu. It is not caused by an error in editing the config - it results for multiple people, independently, without manual edits of the config file being required. If these comments are the cause, it would be consistent with this finding.
I cannot conclusively determine whether the syntax in these comments is connected to the "Configuration file is not correct. Correcting" error, but I was unable to find any other problems in the Quark .toml file that appear as syntax errors in a code editor like Visual Studio Code. If true, then Forge/NeoForge is making a mistake when it checks configuration file syntax - we may have to bring this upstream.
Because this syntax error and Forge's attempts to "correct" the .toml file are listed as a WARN and not an ERROR, they don't show up in crash logs - only the full-length game log. #5062 provided a game log which had the same error with the same file, but #5046 did not, so it's impossible for me to confirm whether more crashes were also preceded by Forge "correcting" your common.toml file. If they were, though, this syntax may be causing widespread crashes.
I will be testing this further by looking more in-depth at the quark-common.toml file and changing syntax in comments to attempt to pin down what errors Forge is detecting in the file. I would suggest that you do the same - whatever Forge is doing to "correct" your file is likely unintended and possibly resulting in serious errors.
This has been raised with NeoForge developers by another member of my devteam to get input on possible causes. I've edited that syntax out of my local config file to see if it removes the error. Unfortunately, I still get the warning ending with
quark-common.toml is not correct. Correcting
after removing that syntax from comments, so it looks like it wasn't the root cause (or else I missed some).
Thanks for looking into this!
The ArrayIndexOutOfBounds
es look like VazkiiMods/Zeta#52 . This was a race condition involving config loading, sadly it was kinda random whether it happened or not.
I believe the "incorrect config" was (partially?) caused by these comments:
#This feature disables itself if any of the following mods are loaded:
# - woodster
# - woodworks
When computing this comment, Zeta previously read the anti-overlap modids out of a HashSet
, so every time you started the game the "correct" ordering of this comment would reroll. I changed it to a TreeSet
in VazkiiMods/Zeta@f32a7a6 so they'll print in alphabetical order.
Both of these should be fixed in the latest versions.