# system.opc.readValues returns null

**URL:** <https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [November 12, 2020, 4:18pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587 "2020-11-12T16:18:24Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 12, 2020, 4:18pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/1 "2020-11-12T16:18:24Z")

</div>

I’m trying to write a script with system.opc.readValues(). As a test I’ve written a small snippet that targets two members of a user defined type in a 1756-L71 ControlLogix 5570 controller. The values I’m trying to pull in are in a structure with this format. There are other sub-items of userType, but I’m not targeting them yet.

```auto
+- userType[100] (array of 100 instances)
    +- userType (instance of user defined type)
        +- id (int)
        +- cuts[70] (array of 70 ints)
            +- cut (int)
            +- cut (int)
            +- cut (int)
            +- cut (int)
            +- etc...

```

When I run the script below I get a value for id, but not for cuts. The OPC paths are copy/pasted from the OPC browser.

```auto
opcServer = 'Ignition OPC-UA Server'

idPath = 'ns=1;s=[myPlcDevice]userType[5].id'
cutPath = 'ns=1;s=[myPlcDevice]userType[5].cuts[10]'

pathsList = [idPath, cutPath]
result = system.opc.readValues(
	opcServer,
	pathsList
)

for path, qualVal in zip(pathsList,result):
	print path
	print qualVal

```

This prints:

```auto
ns=1;s=[myPlcDevice]userType[5].id
[5, Good, Thu Nov 12 07:53:07 PST 2020 (1605196387223)]
ns=1;s=[myPlcDevice]userType[5].cuts[10]
[null, Bad, Sun Dec 31 16:00:00 PST 1600 (-11644473600000)]

```

I also get an error state when I try to pull in (from OPC browser) `'ns=1;s=[myPlcDevice]userType[5].cuts[10]'` as an OPC tag, so the issue might be with OPC-UA server more than with system.opc.readValues.

Is there a weird quirk related to OPC-UA server’s connection to AB PLCs or something else I’m missing?

Ignition 8.0.10

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 4:30pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/2 "2020-11-12T16:30:57Z")

</div>

If you set the log level for the loggers you find searching for “drivers.LogixDriver.Requests” to DEBUG and then do the read again you’ll probably see some errors in the logs.

[https://docs.inductiveautomation.com/display/DOC81/Diagnostics+-+Logs#Diagnostics-Logs-ChangingLoggingLevels](https://docs.inductiveautomation.com/display/DOC81/Diagnostics+-+Logs#Diagnostics-Logs-ChangingLoggingLevels)

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 12, 2020, 4:35pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/3 "2020-11-12T16:35:15Z")

</div>

```auto
ReadArrayTagsRequest	12Nov2020 08:33:53	Error reading 'userType[5].cuts': status=0xFF, additional=[0x2105]
com.digitalpetri.enip.cip.CipResponseException: status=0xFF, additional=[0x2105]

at com.digitalpetri.enip.logix.services.ReadTagFragmentedService.decodeResponse(ReadTagFragmentedService.java:93)

at com.digitalpetri.enip.logix.services.ReadTagFragmentedService.decodeResponse(ReadTagFragmentedService.java:18)

at com.digitalpetri.enip.cip.services.MultipleServicePacketService.decodeResponse(MultipleServicePacketService.java:70)

at com.digitalpetri.enip.cip.services.MultipleServicePacketService.decodeResponse(MultipleServicePacketService.java:18)

at com.digitalpetri.enip.cip.CipClient.lambda$invokeConnected$0(CipClient.java:70)

at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(Unknown Source)

at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(Unknown Source)

at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)

at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source)

at com.digitalpetri.enip.cip.CipClient$ConnectedDataHandler.itemsReceived(CipClient.java:263)

at com.digitalpetri.enip.cip.CipClient.onUnitDataReceived(CipClient.java:232)

at com.digitalpetri.enip.EtherNetIpClient.onChannelRead(EtherNetIpClient.java:194)

at com.digitalpetri.enip.EtherNetIpClient.access$800(EtherNetIpClient.java:49)

at com.digitalpetri.enip.EtherNetIpClient$EtherNetIpClientHandler.lambda$channelRead0$0(EtherNetIpClient.java:319)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 4:41pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/4 "2020-11-12T16:41:58Z")

</div>

Not sure why this response is coming back from the PLC. This might be something we have to try to mock up here and see if it acts the same. What firmware version are you using?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 4:42pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/5 "2020-11-12T16:42:44Z")

</div>

And is there any chance you can get a Wireshark capture of this?

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 12, 2020, 4:43pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/6 "2020-11-12T16:43:58Z")

</div>

30.011

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/74eb459451fc1175382c258d893a91a2f85f4e48.png)

There’s a high chance I can get a wireshark capture if you can tell me what that means or point me in the right direction.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 4:46pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/7 "2020-11-12T16:46:56Z")

</div>

Capturing network traffic using [Wireshark](https://www.wireshark.org/download.html) while the write from Ignition occurs and then uploading the resulting capture. It will allow me to see the details of the request Ignition sent that elicited the error response.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 12, 2020, 4:47pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/8 "2020-11-12T16:47:36Z")

</div>

From computer designer is running on or from gateway server?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 4:48pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/9 "2020-11-12T16:48:11Z")

</div>

It would have to be on the gateway server.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 12, 2020, 4:48pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/10 "2020-11-12T16:48:42Z")

</div>

I’ll work on it.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 5:20pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/11 "2020-11-12T17:20:06Z")

</div>

@zacht we are not able to reproduce this.

If you can download the program to the PLC again and then check if it works that would be an interesting data point.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 12, 2020, 5:47pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/12 "2020-11-12T17:47:09Z")

</div>

I sent you a message with a wireshark capture.

I might be able to download later today. They’re running production now.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 5:51pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/13 "2020-11-12T17:51:06Z")

</div>

The capture was good, I can see the write request and error response. I’m not sure if it will help anything yet.

Let me know if/when you get a chance to do a download.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 12, 2020, 11:52pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/14 "2020-11-12T23:52:04Z")

</div>

`Hello, IT. Have you tried turning it off and back on again?`

I went into the device setup on the gateway webpage. I didn’t make any changes, but hitting save to refresh the connection seems to have fixed the problem. I’m glad you got to see the logs, otherwise I’d think I was going crazy.

The simple thing probably should have been my first step.

Thanks for taking the time to investigate with me @Kevin.Herron

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 12, 2020, 11:54pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/15 "2020-11-12T23:54:47Z")

</div>

Edit/save like that forces a re-browse when we reconnect.

These later Logix firmware versions seem to have a variety of bugs that I assume are related to not correctly handling online edits. We’ve seen cases where the PLC never updates the attributes it’s supposed to update to indicate a re-browse is needed as well as browse data containing invalid/orphaned template references.

---

<div class="post-metadata">

**Author:** ![imt.sebastian.sanche](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@imt.sebastian.sanche](https://forum.inductiveautomation.com/u/imt.sebastian.sanche)\
**Post date:** [February 20, 2024, 9:43pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/16 "2024-02-20T21:43:38Z")

</div>

Hi I have a similar issue with Designer V 8.1.30.

I have a full script to do write values but was not working so I tried to read values and it isn't either.

I did the most basic script to read values to a test tag that I also added to the tag browser so I could monitor it and still get the

> [null, Bad("Bad\_NodeIdUnknown: The node id refers to a node that does not exist in the server address space.")

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/6/0670d8022887a7845bf56777a4de85cbe9ad2b26.png)  
I have tried different tags in different scopes but nothing is working.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 20, 2024, 9:57pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/17 "2024-02-20T21:57:01Z")

</div>

Please start a new topic. There's no indication your problem has any relation to the OP.

---

<div class="post-metadata">

**Author:** ![imt.sebastian.sanche](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@imt.sebastian.sanche](https://forum.inductiveautomation.com/u/imt.sebastian.sanche)\
**Post date:** [February 20, 2024, 10:57pm UTC](https://forum.inductiveautomation.com/t/system-opc-readvalues-returns-null/40587/18 "2024-02-20T22:57:51Z")

</div>

Topic has been created. [OPC Read/Write not working](https://forum.inductiveautomation.com/t/opc-read-write-not-working/86065)
