Game fails to process valid JSON?

I can’t load my own mod because one of the files is not being parsed by the game due to the following error (from debug.log):

20:04:00.996 ERROR : (error message will follow backtrace)
  #0
    (dbghelp: @0x7e68c6[cataclysm-tiles.exe+0x3e68c6]), 
    (libbacktrace: Z21debug_write_backtraceRSo+0x56@0x7e68c6),
    (libbacktrace: 0x7e68c6    [unknown src]:0    [unknown func]),
  #1
    (dbghelp: @0x7e735a[cataclysm-tiles.exe+0x3e735a]), 
    (libbacktrace: Z8DebugLog10DebugLevel10DebugClass+0x34a@0x7e735a),
    (libbacktrace: 0x7e735a    [unknown src]:0    [unknown func]),
  #2
    (dbghelp: @0x7ea076[cataclysm-tiles.exe+0x3ea076]), 
    (libbacktrace: Z12realDebugmsgPKcS0_S0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x76@0x7ea076),
    (libbacktrace: 0x7ea076    [unknown src]:0    [unknown func]),
  #3
    (dbghelp: IMG_LoadWEBP_RW+0x11bed4@0x18bbb44[cataclysm-tiles.exe+0x14bbb44]), 
    (libbacktrace: Z12realDebugmsgIJPKcEEvS1_S1_S1_S1_DpOT_+0x344@0x18bbb44),
    (libbacktrace: 0x18bbb44    [unknown src]:0    [unknown func]),
  #4
    (dbghelp: @0xccfe73[cataclysm-tiles.exe+0x8cfe73]), 
    (libbacktrace: ZN9main_menu17new_character_tabEv+0x1f33@0xccfe73),
    (libbacktrace: 0xccfe73    [unknown src]:0    [unknown func]),
  #5
    (dbghelp: @0xcd4bba[cataclysm-tiles.exe+0x8d4bba]), 
    (libbacktrace: ZN9main_menu14opening_screenEv+0x87a@0xcd4bba),
    (libbacktrace: 0xcd4bba    [unknown src]:0    [unknown func]),
  #6
    (dbghelp: IMG_LoadWEBP_RW+0x912654@0x20b22c4[cataclysm-tiles.exe+0x1cb22c4]), 
    (libbacktrace: main+0x1524@0x20b22c4),
    (libbacktrace: 0x20b22c4    [unknown src]:0    [unknown func]),
  #7
    (dbghelp: @0x4013ed[cataclysm-tiles.exe+0x13ed]), 
    (libbacktrace: _tmainCRTStartup+0x23d@0x4013ed),
    (libbacktrace: 0x4013ed    /home/narc/src/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-5.4.0.build_/mingw-w64-v5.0.2/mingw-w64-crt/crt/crtexe.c:336    __tmainCRTStartup),
  #8
    (dbghelp: @0x4014fb[cataclysm-tiles.exe+0x14fb]), 
    (libbacktrace: WinMainCRTStartup+0x1b@0x4014fb),
    (libbacktrace: 0x4014fb    /home/narc/src/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-5.4.0.build_/mingw-w64-v5.0.2/mingw-w64-crt/crt/crtexe.c:186    WinMainCRTStartup),
  #9
    (dbghelp: BaseThreadInitThunk+0x14@0x7ffd2a5381f4[KERNEL32.DLL+0x181f4]), 
    (backtrace_syminfo failed: errno = -1, msg = no symbol table in PE/COFF executable),
    (backtrace_pcinfo failed: errno = -1, msg = no debug info in PE/COFF executable),
  #10
    (dbghelp: RtlUserThreadStart+0x21@0x7ffd2cf0a251[ntdll.dll+0x6a251]), 
    (backtrace_syminfo failed: errno = -1, msg = no symbol table in PE/COFF executable),
    (backtrace_pcinfo failed: errno = -1, msg = no debug info in PE/COFF executable),
Backtrace emission took 0 seconds.
src/main_menu.cpp:781 [bool main_menu::new_character_tab()] Error: data/mods//HomesteadInstrumentsInc/furniture/servers.json: line 1:1: Expected string or array

[
^

  {
    "type": "furniture",

As you can see, the game points at the array and says it’s not “string or array” as it expected.

I have the JSON structure checked manually and with two different validators: result 1, result 2 (under the code window). All JSON editors I’ve used to so far also parse it perfectly, providing collapsing of sections as expected and yielding no errors.

What do?

1 Like

I haven’t programmed much in CDDA, but the way this is worded maybe it can’t parse JSONs that use tabulators instead of spaces. This shouldn’t be a case with most JSON parsers, but it’s just a thought, because I don’t actually know for sure what this error may mean.

Something about the second furniture object in that file causes it to fail. Removing that allows it to load to the next error (missing construction id).

1 Like

Looking at it further, copy-from is the problematic bit. Removing it and adding back the missing mandatory members allows it to load that file. After that, you can then add back copy-from and it loads that file.

1 Like

That’s one hell of a thorough look you gave it. Thanks a lot!

Could you elaborate on the copy-from bit and how it affects loading? I thought I had the required parts defined for the second object: id, type, name, and description, right?

diff --git a/furniture/servers.json b/furniture/servers.json
index 5768a21..442ee60 100644
--- a/furniture/servers.json
+++ b/furniture/servers.json
@@ -42,6 +42,10 @@
     "type": "furniture",
     "id": "f_server_working",
     "copy-from": "f_server",
+    "symbol": ":",
+    "color": "blue_white",
+    "move_cost_mod": -1,
+    "required_str": 1,
     "name": "server stack (working)",
     "description": "This is a rack full of compact computer devices.  The indicator lights are shining and flickering. Can be used in extensive computations.",
     "//": "emits a little light due to the I/O lights",
@@ -59,4 +63,4 @@
       ]
     }
   }
-]
\ No newline at end of file
+]

This is my diff to make it load.
The newline at the end of the file isn’t necessary.
Removing any of these (with the exception of color) causes the same issue you got, and not having color gives an error that you need either color or bgcolor

2 Likes

Just tested it. Works like a charm. Thanks a lot!

Missing symbols are causing issues with most of the Homestead items now, though the Project-Apex files seem to have included them.

Also I didn’t find this thread until after I’d already dealt with the issue you have here, that copy-from error had me stuck for a good while, I ended up making the same changes as anothersimulcrum through blind luck, just comparing your furniture defs to known working mods.

Hope you keep working on these they look promising!

You’re not saying you’re using Homestead for your own mods, are you? It hasn’t even seen its first release yet.