For the function JSON_ADD_ITEM, an invalid JSON document results in a FAULT_OTHER of the script. According to the documentation, however, the function should return 45334 in this case.
Documentation: https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/12.3/Automic Automation Guides/help.htm#Script/Reference/JSON_ADD_ITEM.htm
Example:
! Error because of invalid JSON
:SET &JSON# = "{"
:SET &NR# = 1
:SET &RET# = JSON_ADD_ITEM(&JSON#, "$", &NR#, "number", number)
:PRINT &RET#
Release : 12.3
Component : AUTOMATION ENGINE
Software Bug
This has been confirmed to be a bug and will be fixed in a future release. No release date is known yet.