# Gateway event occasionally error when execute Project libary script : NameError: name is not defined

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-occasionally-error-when-execute-project-libary-script-nameerror-name-is-not-defined/92012>\
**Category:** Ignition\
**Tags:** perspective, ignition81, scripting\
**Created:** [June 18, 2024, 12:26pm UTC](https://forum.inductiveautomation.com/t/gateway-event-occasionally-error-when-execute-project-libary-script-nameerror-name-is-not-defined/92012 "2024-06-18T12:26:27Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Brandon\_Peterson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brandon_peterson/32/32960_2.png) [@Brandon\_Peterson](https://forum.inductiveautomation.com/u/Brandon_Peterson)\
**Post date:** [June 18, 2024, 1:10pm UTC](https://forum.inductiveautomation.com/t/gateway-event-occasionally-error-when-execute-project-libary-script-nameerror-name-is-not-defined/92012/6 "2024-06-18T13:10:32Z")

</div>

I've had a problem like this before. I'm not sure if it's the same thing here, but it would be worth a check.

> [@Project Library Script Scope Issues in Gateway Scheduled Script](https://forum.inductiveautomation.com/t/project-library-script-scope-issues-in-gateway-scheduled-script/76137/2):
>
> That usually means someone edited that script and introduced a syntax error. Or some other error is occurring at the top level, prevent it from being imported. Look in your gateway logs. Try making a trivial change in that script, and saving the project. If there's a problem with its automatic import, it should show up in the gateway log shortly after. (Adding or removing a blank line at the bottom is a pretty safe trivial change.)

If you can safely call this script from the Script Console, then your script is compiling and this isn't the solution to your issue.

If it is a compile error, a common culprit is spacing. It doesn't matter if you use tabs or spaces, so long as you're consistent. I'd recommend turning on whitespace characters when looking through the script to find invisible errors. To see them, right-click in the script editor to find the setting.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c7377133c7bc713ed203ebaf9f2483ecdb79811e.png)

Once it's selected, you'll see tabs as arrows and spaces as tiny dots:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/0/203e1270de53fa8b9a335b0dd0044b4177ef8d55.png)

This can help you find errors that would otherwise be easy to miss:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/8/68f3b55302c6071739edf27f83e0c269e4e37ed1.png)

---

_[View the full topic](https://forum.inductiveautomation.com/t/gateway-event-occasionally-error-when-execute-project-libary-script-nameerror-name-is-not-defined/92012)._
