# \[IGN-11148\]Locating script errors from Wrapper log

**URL:** <https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691>\
**Category:** Ignition\
**Created:** [March 2, 2022, 4:10am UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691 "2022-03-02T04:10:45Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 2, 2022, 4:10am UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/1 "2022-03-02T04:10:45Z")

</div>

Is there a way to pinpoint exactly what script and where from the wrapper log?

I have this logged:

```python
Error during blocking read of tags through scripting. project-name=<PROJECTNAME>
java.util.concurrent.TimeoutException: null
at java.base/java.util.concurrent.CompletableFuture.timedGet(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)
at com.inductiveautomation.ignition.gateway.script.GatewayTagUtilities.readBlockingImpl(GatewayTagUtilities.java:190)
at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.readBlocking(AbstractTagUtilities.java:401)
at jdk.internal.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:188)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:539)
at org.python.core.PyObject. __call__ (PyObject.java:480)
at org.python.core.PyObject. __call__ (PyObject.java:484)
at org.python.pycode._pyx59492.refresh$1(<custom-method refresh>:32)
at org.python.pycode._pyx59492.call_function(<custom-method refresh>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:139)
at org.python.core.PyFunction. __call__ (PyFunction.java:413)
at org.python.core.PyMethod. __call__ (PyMethod.java:126)
at org.python.pycode._pyx59490.onMessageReceived$1(<function:onMessageReceived>:2)
at org.python.pycode._pyx59490.call_function(<function:onMessageReceived>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function ___call__ (PyFunction.java:471)
at org.python.core.PyFunction. __call__ (PyFunction.java:466)
at org.python.core.PyFunction. __call__ (PyFunction.java:461)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:842)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:824)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:687)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:993)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:752)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:133)
at com.inductiveautomation.perspective.gateway.model.MessageHandlerCollection$MessageHandlerImpl$1.lambda$invoke$0(MessageHandlerCollection.java:81)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
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)

```

From this I can gather that there's a script calling `system.tag.readBlocking` being called from a custom method called `refresh`. Apart from that though, I have no further context. I've found 6 locations that have a `refresh` custom method, but what if I had 100?

Is there some other way that I can narrow this down from the log?  
How would IA go about finding the culprit?

---

<div class="post-metadata">

**Author:** ![SKA](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ska/32/29528_2.png) [@SKA](https://forum.inductiveautomation.com/u/SKA)\
**Post date:** [March 2, 2022, 8:26am UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/2 "2022-03-02T08:26:52Z")

</div>

I would start at line 32 in the custom method refresh.

`at org.python.pycode._pyx59492.refresh$1(<custom-method refresh>:32)`

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 2, 2022, 8:29am UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/3 "2022-03-02T08:29:10Z")

</div>

But what if there are 100 custom methods called refresh ?  
I agree that the traces we get are esoteric at best, figuring out the source of an error is a pain in the rear end.

---

<div class="post-metadata">

**Author:** ![SKA](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ska/32/29528_2.png) [@SKA](https://forum.inductiveautomation.com/u/SKA)\
**Post date:** [March 2, 2022, 8:41am UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/4 "2022-03-02T08:41:42Z")

</div>

Then i would say you would have a naming issue to deal with.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 2, 2022, 8:44am UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/5 "2022-03-02T08:44:24Z")

</div>

Really ? Do you think it seems wrong to have a `refresh` method on several classes ?

Now imagine instead of `refresh`, the culprit is ` __str__ ` or ` __iter__ `. How do you fix the naming issue ?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 2, 2022, 9:18am UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/6 "2022-03-02T09:18:46Z")

</div>

If you have lots of components that all need a refresh method, then they should all be called refresh for consistency and for sanity. But the logs just say that a refresh method has the issue without any context of which component on what view ☹

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 2, 2022, 3:20pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/7 "2022-03-02T15:20:09Z")

</div>

Well, don’t discount the rest of the stack.

You’ve also got a project name, via MDC key:  
`project-name=<PROJECTNAME>`  
And you know that it’s a message handler, by the function name:

```auto
at org.python.pycode._pyx59490.onMessageReceived$1(<function:onMessageReceived>:2)

```

And more specifically, you know that it’s a _Perspective_ message handler:

```auto
at com.inductiveautomation.perspective.gateway.model.MessageHandlerCollection$MessageHandlerImpl$1.lambda$invoke$0(MessageHandlerCollection.java:81)

```

Honestly, in this particular scenario, I think that _is_ as much context as we can give you; on line 2 of a message handler in Perspective in project `PROJECTNAME` you’re calling a project script called `refresh`, which is trying to read some tag(s) and timing out.

I guess I could see an argument for trace/debug logging for invoked messages, or something like that (I don’t see any from a quick glance in the code, but there could still be some), but as an example this is a pretty good stacktrace compared to some I’ve seen 🙂

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 4, 2022, 4:19pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/8 "2022-03-04T16:19:08Z")

</div>

What about this one?

```auto
Uncaught Throwable during execution. view=Packaging/Wine Delivery/Line 4/SHF Delivery@C, project-name=<PROJECTNAME>
java.lang.IllegalArgumentException: Malformed path: 1
at com.inductiveautomation.ignition.common.JsonPath.parse(JsonPath.java:242)
at com.inductiveautomation.perspective.gateway.property.PropertyTree.write(PropertyTree.java:424)
at com.inductiveautomation.perspective.gateway.model.ElementBindingHarness.writeToTarget(ElementBindingHarness.java:57)
at com.inductiveautomation.perspective.gateway.model.AbstractBindingHarness.valueReady(AbstractBindingHarness.java:343)
at com.inductiveautomation.perspective.gateway.model.AbstractBindingHarness$TransformSequencer.lambda$transformComplete$0(AbstractBindingHarness.java:289)
at com.inductiveautomation.perspective.gateway.api.LoggingContext.lambda$mdcWrap$0(LoggingContext.java:41)
at com.inductiveautomation.ignition.common.util.ExecutionQueue$PollAndExecute.run(ExecutionQueue.java:210)
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:** ![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:** [March 4, 2022, 4:20pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/9 "2022-03-04T16:20:37Z")

</div>

No script in that one. Just a binding.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 4, 2022, 4:39pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/10 "2022-03-04T16:39:12Z")

</div>

There isn’t really any identifying info though telling me which binding it is on what component - I don’t know if that’s even possible information to add, but it would certainly help to narrow down which component has the error. I don’t see any errors on the page itself 😕

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [March 4, 2022, 7:48pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/11 "2022-03-04T19:48:52Z")

</div>

On binding errors you should have an overlay showing you that you have a binding issue unless you have the overlays disabled.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 4, 2022, 8:57pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/12 "2022-03-04T20:57:54Z")

</div>

`perspective.ComponentModel` (or `ViewModel` or `PageModel`) on trace should have some extra context that helps debug that.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 4, 2022, 8:59pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/13 "2022-03-04T20:59:31Z")

</div>

Ah cool, I do have some of those as well. I don’t suppose there’s any way to link them together?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 4, 2022, 9:08pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/14 "2022-03-04T21:08:25Z")

</div>

I’m not really sure what you mean by that.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 4, 2022, 9:21pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/15 "2022-03-04T21:21:16Z")

</div>

To link the binding error above with the ComponentModel etc. errors

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 4, 2022, 9:23pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/16 "2022-03-04T21:23:31Z")

</div>

`at com.inductiveautomation.perspective.gateway.model.ElementBindingHarness.writeToTarget(ElementBindingHarness.java:57)`

Line 5 **6** of ElementBindingHarness is this:  
`targetComponent.getLogger().tracef("%s writing %s=\"%s\"", typeCode, targetProperty, value); `  
`getLogger()` should be `perspective.ComponentModel` (or `Page` or `View)` - so if that logger is on trace, you should see that trace log _immediately_ before the error above.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [October 22, 2024, 1:27pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/17 "2024-10-22T13:27:11Z")

</div>

> [@paul-griffith](#):
>
> Honestly, in this particular scenario, I think that _is_ as much context as we can give you

I don't fully understand why this would be enough context. You could also specify the view and the component it is triggered on, or can't you?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 22, 2024, 3:55pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/18 "2024-10-22T15:55:01Z")

</div>

No, you're right, that's a fair point. Generally errors from Perspective are set up with an appropriate MDC context that'll give you a much better time locating where the error happened, but message handlers appear to have missed that treatment. I just filed a ticket to remedy that.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [October 22, 2024, 3:56pm UTC](https://forum.inductiveautomation.com/t/ign-11148-locating-script-errors-from-wrapper-log/56691/19 "2024-10-22T15:56:32Z")

</div>

Sounds good!
