NullPointerException when open62541 opc ua tag is updated

I’m developing an OPC UA server based on open62541.
One of the nodes is publishing a json string every minute.

Using the OPC Quick Client I can set a subscription and see it getting updated every minute. Server, address, value, quality and timestamp all seem ok.
Also when using UaExpert I can see it getting updated every minute.

Problems start to arise when I try open Ignition Designer, add a tag for the OPC UA node and add a script on valueChanged. The script only gets called when I apply it in the script editor but it doesn’t get called every minute, as I would expect.

When I check the wrapper.log, I see NullPointerException: Error processing tag value change every minute (same as the update rate). You can find the full stack trace below.

I assume that some configuration in open62541 is incompatible with Ignition but since I can’t debug Ignition, I have no idea where to start looking.

What is the best way to troubleshoot this? Does this sound familiar to anybody?

INFO | jvm 1 | 2021/10/12 14:43:50 | E [t.e.core ] [12:43:50]: Error processing tag value change.
INFO | jvm 1 | 2021/10/12 14:43:50 | java.lang.NullPointerException: null
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.common.TypeUtilities.coerce(TypeUtilities.java:1365)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.common.TypeUtilities.coerceNullSafe(TypeUtilities.java:838)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.gateway.tags.runtime.nodes.ExecutableTag.coerceAndCheck(ExecutableTag.java:312)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.gateway.tags.runtime.nodes.ExecutableTag.valueChanged(ExecutableTag.java:379)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.gateway.tags.actors.factories.value.AbstractValueGeneratingActor.fireValueChange(AbstractValueGeneratingActor.java:73)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.gateway.tags.actors.factories.value.AbstractValueGeneratingActor.fireValueChange(AbstractValueGeneratingActor.java:45)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.gateway.tags.actors.factories.value.opc.OpcActorFactory$OpcActor.setValue(OpcActorFactory.java:818)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.gateway.opcua.client.connection.OpcUaSubscriptionSynchronizer$DataValueConsumer.accept(OpcUaSubscriptionSynchronizer.kt:625)
INFO | jvm 1 | 2021/10/12 14:43:50 | at com.inductiveautomation.ignition.gateway.opcua.client.connection.OpcUaSubscriptionSynchronizer$DataValueConsumer.accept(OpcUaSubscriptionSynchronizer.kt:597)
INFO | jvm 1 | 2021/10/12 14:43:50 | at org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaMonitoredItem.lambda$setValueConsumer$0(OpcUaMonitoredItem.java:152)
INFO | jvm 1 | 2021/10/12 14:43:50 | at org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaMonitoredItem.onValueArrived(OpcUaMonitoredItem.java:212)
INFO | jvm 1 | 2021/10/12 14:43:50 | at org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaSubscriptionManager.lambda$null$44(OpcUaSubscriptionManager.java:695)
INFO | jvm 1 | 2021/10/12 14:43:50 | at org.eclipse.milo.opcua.stack.core.util.ExecutionQueue$Task.run(ExecutionQueue.java:119)
INFO | jvm 1 | 2021/10/12 14:43:50 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO | jvm 1 | 2021/10/12 14:43:50 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO | jvm 1 | 2021/10/12 14:43:50 | at java.base/java.lang.Thread.run(Unknown Source)
INFO | jvm 1 | 2021/10/12 14:44:11 | E [d.T.TCPConnection[4840] ] [12:44:11]: Connection lost.
INFO | jvm 1 | 2021/10/12 14:44:11 | java.io.IOException: End of stream reached.
INFO | jvm 1 | 2021/10/12 14:44:11 | at com.inductiveautomation.iosession.socket.AsyncSocketIOSession.run(AsyncSocketIOSession.java:74)
INFO | jvm 1 | 2021/10/12 14:44:11 | at java.base/java.lang.Thread.run(Unknown Source)

What is the datatype of the corresponding Ignition OPC tag?

It seems to be some sort of recognition problem.

In open62541 it is declared as a UA_TYPES_STRING node.
When I selected it via Tag Browser > + > Browse devices > connected devices it was recognized and added as String array.
When I created it via Tag Browser > + > New standard tag > OPC tag and then set all values manually to the correct values (String and correct OPC connection) then the problem disappeared and everything works as intended.

Check the ValueRank and ArrayDimensions attributes of the node in your server.

The JSON-like value coupled with the incorrect array DataType on the Ignition OPC tag triggers some weird code path in our TypeUtilities that fails.