Jump to content

Recommended Posts

Posted

Hi, I've been trying to add a config file and ConfigLib compatibility to my code mod for a while. I was able to confirm that the individual settings function properly using another mod's domain that utilizes Configlib as a base for testing. But for some reason using my own domain in configlib-patches.json breaks the config entirely, locking each setting to their default and producing the error below in the log:

Spoiler

7.6.2025 00:09:27 [Error] [Config lib] (somedisassemblyrequired) Error on parsing config: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: C. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json)
at ConfigLib.Config.ParseJson(JsonObject json, Dictionary`2& settings, SortedDictionary`2& configBlocks, String& defaultConfig, String domain) in D:\Projects\VintageStory\configlib\configlib\source\Config\Config.cs:line 292
at ConfigLib.Config..ctor(ICoreAPI api, String domain, String modName, JsonObject json, String file) in D:\Projects\VintageStory\configlib\configlib\source\Config\Config.cs:line 79.
7.6.2025 00:09:27 [Notification] [Config lib] Configs loaded: 1

(Another thing of note: The config file in the ModConfig folder is generated with only the file pathway to itself.)

If any of you are familiar with Configlib and/or this error please tell me what I'm doing wrong.

Posted

The error suggests that there is a problem with the parsing of your config file to .json format. This happens when there are character in your file that shouldn't be there, if you could attach your config file or paste it in a message, I could help you better at understanding what's the problem. 
 

Posted (edited)
4 hours ago, DarkWalf88 said:

The error suggests that there is a problem with the parsing of your config file to .json format. This happens when there are character in your file that shouldn't be there, if you could attach your config file or paste it in a message, I could help you better at understanding what's the problem. 
 

Here's the configlib-patches.json file:

Spoiler

{
  "version": 1.1,
  "file": "somedisassemblyrequired.json",
  "settings": {
    "boolean": {
      "ENABLEANVILRECYCLING": {
        "name": "enableAnvilRecycling",
        "ingui": "somedisassemblyrequired:enableAnvilRecycling",
        "weight": 1,
        "comment": "somedisassemblyrequired:enableAnvilRecyclingComment",
        "default": false
      },
      "ENABLE_METAL_BIT_RECYCLING": {
        "name": "enableMetalBitRecycling",
        "ingui": "somedisassemblyrequired:enableMetalBitRecycling",
        "weight": 2,
        "comment": "somedisassemblyrequired:enableMetalBitRecyclingComment",
        "default": false
      },
      "ENABLE_TOOL_RECYCLING": {
        "name": "enableToolRecycling",
        "ingui": "somedisassemblyrequired:enableToolRecycling",
        "weight": 3,
        "comment": "somedisassemblyrequired:enableToolRecyclingComment",
        "default": true
      },
      "ENABLE_SWORD_RECYCLING": {
        "name": "enableSwordRecycling",
        "ingui": "somedisassemblyrequired:enableSwordRecycling",
        "weight": 4,
        "comment": "somedisassemblyrequired:enableSwordRecyclingComment",
        "default": true
      },
      "ENABLE_RANGED_RECYCLING": {
        "name": "enableRangedRecycling",
        "ingui": "somedisassemblyrequired:enableRangedRecycling",
        "weight": 5,
        "comment": "somedisassemblyrequired:enableRangedRecyclingComment",
        "default": true
      }
    }
  },
  "formatting": [
    {
      "type": "separator",
      "title": "somedisassemblyrequired:vanillaRecipeSettings",
      "weight": 0.5
    },
    {
      "type": "separator",
      "title": "somedisassemblyrequired:modRecipeSettings",
      "weight": 2.5
    }
  ]
}
 

Some other details: this file is stored at assets/somedisassemblyrequired/config and this json is considered valid using a json validator. Also the in-game config settings only generate when the “file” line is removed. But those settings have no effect on the actual config file.

Edited by SevenIndex
Adding more details
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.