Minecraftforge: [1.13.2] Cannot read Enum from config: unquoted value not recognized

Created on 19 Feb 2019  路  8Comments  路  Source: MinecraftForge/MinecraftForge

Tested using Forge 25.0.42.
Minimal config spec: https://gist.github.com/Cypher121/2185d50a7a71329fb5bc79294932adb4

This produces a TOML config file:

[general]
    #Test Facing
    facing = BACK

which fails to load next time the game is launched:

com.electronwill.nightconfig.core.io.ParsingException: Invalid value: BACK
    at com.electronwill.nightconfig.core.io.Utils.parseLong(Utils.java:67)
    at com.electronwill.nightconfig.toml.ValueParser.parseNumber(ValueParser.java:121)
    at com.electronwill.nightconfig.toml.ValueParser.parse(ValueParser.java:59)
    at com.electronwill.nightconfig.toml.ValueParser.parse(ValueParser.java:64)
    at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:57)
    at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:101)
    at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:88)
    at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37)
    at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113)
    at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219)
    at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:202)
    at com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73)
    at com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85)
    at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$0(ConfigFileTypeHandler.java:46)
    at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:88)
    at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$0(ConfigTracker.java:78)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2062)
    at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:78)
    at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:135)
    at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:52)
    at net.minecraft.client.Minecraft.init(Minecraft.java:411)
    at net.minecraft.client.Minecraft.run(Minecraft.java:344)
    at net.minecraft.client.main.Main.main(SourceFile:144)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:35)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:58)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:44)
    at net.minecraftforge.userdev.UserdevLauncher.main(UserdevLauncher.java:77)

Either parser should be re-configured to support unquoted values in some manner, or Enum.valueOf and Enum#name should be used to write strings instead.

1.13 Bug Superseded

Most helpful comment

tterrag is looking into it, and it appears reading works... ish. And writing is still broken.
He has a work around but i'd rather it be fixed properly upstream. So I've told him to see about reporting it properly.

All 8 comments

Looks like the core issue here is that there's no (de)serializer for Enums at all, so it defaults to writing toString() out unquoted. Same goes for most other classes, but since there's a special option for Enum properties in the spec builder, I expected them to be supported.

Also might be a good idea to throw errors on unsupported types when they're written and not when they fail to read afterwards, if that's possible

Reported upstream.

Upstream here. Thanks for reporting I agree with @Cypher121: an exception should be thrown when writing unsupported types, and enum values should be supported.

I take it that this will be fixed once Forge updates to NightConfig v3.5.0.

We are waiting on upstream to publish/finished whatever needs to be done. Once that's done we can look into uptaking it.

@TheElectronWill The published v3.5.0 release fixes this, right?

tterrag is looking into it, and it appears reading works... ish. And writing is still broken.
He has a work around but i'd rather it be fixed properly upstream. So I've told him to see about reporting it properly.

Writing should be fixed in 3.5.1 - for all languages this time :smile:

Was this page helpful?
0 / 5 - 0 ratings