Quality of document tag keeps changing

Hello! I have an array of structs that I am trying to render in a table in perspective. The tag's quality was good a couple of days ago, and now it is bad after a reboot of the PLC. Between reboots, none of the logic changed which is why this is puzzling.

TYPE iLog : STRUCT
   level: WSTRING(256);
   msg: WSTRING(256);
   timestamp: UDINT;
END_STRUCT
END_TYPE
_logs: ARRAY [0..99] OF iLog;

I am able to attach an OPC tag to the _logs array and view it within perspective. However, perspective says that the value is bad with the following error: Bad("Bad_DecodingError: Decoding halted because of invalid data in the stream."). I also assigned the datatype of the tag as Document.

Heres a more detailed log of the error:

Message: Error writing to Quality.value: Error_TypeConversion("Cannot coerce value 'Bad("Bad_DecodingError: Decoding halted because of invalid data in the stream.")' into type: class com.inductiveautomation.ignition.common.model.values.QualityCod
Time: Mon Jul 29 1:58:48PM
Severity: ERROR
Logger: com.inductiveautomation.ignition.client.util.gui.ErrorUtil

Below is some info about the software I am using:

  • codesys v3.5
  • ignition edge 8.1.21
  • perspective 2.1.21

Please let me know if I can provide anymore info. Thank you!

The "more detailed log" seems to be from a write, so I'm not sure how these are related other than perhaps being for the same tag.

Are there any errors in the Ignition Gateway logs? Have you edit/saved that OPC UA connection? Did the structure definition change at all?

Previously we established that you'll need to upgrade in order to write to a structure array (document array).

Oops! Didn't realize that detailed log was from a write attempt, please ignore it. I am only trying to read the document array.

Are there any errors in the Ignition Gateway logs?
I set the GatewayEventScriptNode and GatewayInterface log levels to TRACE and then deleted the tag, added it back, and tried to read it via the script console

print system.tag.readBlocking(["[edge]eventMgr/_logs"])

which gave me the error: [[null, Bad("Bad_DecodingError: Decoding halted because of invalid data in the stream."), Mon Jul 29 17:01:14 EDT 2024 (1722286874248)]]

Nothing appeared in the console (the logs) either but im not sure if I set the correct log level settings.

Have you edit/saved that OPC UA connection?
I'm not completely sure what you mean by this, could you add more details? I've deleted, added, and refreshed the tag multiple times and still get this error. Is there something else I can try with the OPC UA connection?

Did the structure definition change at all?
The structure didn't change either. I've tried other 'simpler' data types (ex: INT instead of ULINT) and still have the same error.

In the Gateway just edit and save the connection to that device. It forces a reconnect and the DataType information to be re-read.

1 Like

These steps fixed it! Thank you!! What could've caused this and is there any way I can prevent it in the future?

I'm not entirely sure why this worked. It suggests that maybe something about the datatype dictionary / definitions changed in the server, or when we reconnected the last time reading it failed.

1 Like

okay I see. If I run into this issue again then I can use your solution which is good enough. Thanks again!!! Spent too long trying to figure this out