# Gateway Script Error

**URL:** <https://forum.inductiveautomation.com/t/gateway-script-error/43831>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [February 25, 2021, 5:02pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831 "2021-02-25T17:02:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [February 25, 2021, 5:02pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/1 "2021-02-25T17:02:22Z")

</div>

Recently I updated a project from 7.9 to 8.1. I have error collection set up to add entries to the log when a script fails but I’ve noticed in 8.1 if a tag write fails it doesn’t trigger my error collection. Anyone have a suggestion?

I have something like this in a gateway timer script:

```auto
import traceback
import sys

try:
	someScript()
except Exception, err:
	exc_type, exc_value, exc_tb = sys.exc_info()
	errtb = traceback.format_exception(exc_type, exc_value, exc_tb)
	errStr = str('Text describing script: '+str(err)+errtb[1] + errtb[2])
	logger = system.util.getLogger("text")
	logger.info(errStr)

```

This is the only entry I see in the logger when a tag write fails:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/267bc17f0278b91b9447eef5fa8b2944b653aeec.png)

---

<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:** [February 25, 2021, 5:17pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/2 "2021-02-25T17:17:07Z")

</div>

Is that script calling `writeBlocking` directly or one of the deprecated tag write calls from 7.9?

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [February 25, 2021, 5:51pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/3 "2021-02-25T17:51:37Z")

</div>

It was originally a writeAll from 7.9 but I updated it to writeBlocking because the legacy script error description didn’t help in identifying what caused the error. I found the script that caused the error but where it didn’t trigger my try/except I didn’t have anything to point me to which script did it. When it gave the error I posted it was using the writeBlocking.

---

<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:** [February 25, 2021, 6:00pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/4 "2021-02-25T18:00:44Z")

</div>

What 8.1 version is this? Trying to get the line numbers to match up and see if an exception should have been thrown earlier or not.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [February 25, 2021, 6:01pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/5 "2021-02-25T18:01:38Z")

</div>

This is 8.1.1.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [February 26, 2021, 4:53pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/6 "2021-02-26T16:53:19Z")

</div>

Hey @Kevin.Herron, did you find anything with where the exception is thrown? Should it be thrown earlier or do I need to add more error catching some how for when a tag write fails?

---

<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:** [February 26, 2021, 4:58pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/7 "2021-02-26T16:58:24Z")

</div>

There is an incorrectly implemented sanity check on tagPaths vs values list sizes in that `AbstractTagUtilities::writeBlocking` method that causes the call to continue on to a deeper system that has the same correctly implemented check, but logs and returns bad results rather than throwing the Exception.

There is nothing you can do to catch an Exception here, you’ll have to check the results instead. We should be able to fix this particular case though.

---

<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:** [February 26, 2021, 5:07pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/8 "2021-02-26T17:07:07Z")

</div>

Ah, looks like somebody already fixed this. It’ll be in 8.1.4.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [February 26, 2021, 5:08pm UTC](https://forum.inductiveautomation.com/t/gateway-script-error/43831/9 "2021-02-26T17:08:12Z")

</div>

Thats great! I was just looking at ways for doing a sanity check myself before doing the write. If its already fixed I won’t go to far into it.

Thank you!
