# system.opcua.callMethod: BadInvalidState

**URL:** <https://forum.inductiveautomation.com/t/system-opcua-callmethod-badinvalidstate/97307>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [October 16, 2024, 1:16pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-badinvalidstate/97307 "2024-10-16T13:16:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [October 16, 2024, 1:16pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-badinvalidstate/97307/1 "2024-10-16T13:16:48Z")

</div>

Hi, I am making heavy use of the `system.opcua.callMethod` function. An example of a typical call is:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1d6be1a083fd8dcce381f4c3709eb995ec939eaa.png)  
but `serialnumber_details_CQ` is by far not the only opcua method I call on the `OpcRouter` server.  
My calls happen asynchronously: some calls are originated by a gateway timer, some more by mobile devices handled by operators in the factory, so that it is not defined if calls can overlap or start just at the same time. Most of the time each call works correctly, but sometimes I log a bad result:  
 ![Screenshot from 2024-10-16 14-56-36](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/b/bb60be407af0e9348e484a9f8cbb1793202134da.png)  
and the operator does not get the expected answer.  
When that error occurs, if I read through the OPC UA server log, I find no log of an incoming OPC UA method call. Therefore I think that in those cases my call stops at the Ignition gateway.  
Any idea about possible reasons? Workarounds?

Thanks in advance, regards

---

<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:** [October 16, 2024, 1:25pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-badinvalidstate/97307/2 "2024-10-16T13:25:18Z")

</div>

This StatusCode comes from the server, so the call must be happening. I’m afraid you need to look at the server for answers. Wireshark would capture the call as it’s being made and responded to. Not sure if that will help.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [October 16, 2024, 2:44pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-badinvalidstate/97307/3 "2024-10-16T14:44:56Z")

</div>

Many thanks @Kevin.Herron , I will investigate further
