# Named query failing on gateway scripting project

**URL:** <https://forum.inductiveautomation.com/t/named-query-failing-on-gateway-scripting-project/86565>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 29, 2024, 3:08am UTC](https://forum.inductiveautomation.com/t/named-query-failing-on-gateway-scripting-project/86565 "2024-02-29T03:08:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amy.sudibyo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amy.sudibyo/32/38659_2.png) [@amy.sudibyo](https://forum.inductiveautomation.com/u/amy.sudibyo)\
**Post date:** [February 29, 2024, 3:08am UTC](https://forum.inductiveautomation.com/t/named-query-failing-on-gateway-scripting-project/86565/1 "2024-02-29T03:08:55Z")

</div>

A bit of a strange one... we have a button script which calls a named query, and so far has been working successfully for some time.

Recently it has been failing and returning the follow error:

```auto
Error running action 'component.onActionPerformed' on Reporting/LotPackReports@C/root/Buttons/GenerateSPCReports: Traceback (most recent call last): File "<function:runAction>", line 103, in runAction at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.interpretWithOptionalProject(GatewayDBUtilities.java:476) at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.runNamedQuery(GatewayDBUtilities.java:391) at jdk.internal.reflect.GeneratedMethodAccessor936.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Project name required for script execution: the Gateway Scripting Project is not set.

```

It's strange because the gateway scripting project is set, always has been, nothing has changed here. Also, I would have thought gateway scripting project would not be relevant in perspective session scope? I have confirmed that the named query still exists and is receiving the correct parameters.

```auto
groups = system.db.runNamedQuery('Recipe/GetRecipeGroupsForOp',{'itemNumber':itemNumber,'operation':cell})

```

We are running 8.1.25 - I realise this is somewhat old now but it's difficult to get the opportunity to update at this client site.

There are many, many other named queries in this project which are presumably working otherwise the whole system would have ground to a halt.

---

<div class="post-metadata">

**Author:** ![amy.sudibyo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amy.sudibyo/32/38659_2.png) [@amy.sudibyo](https://forum.inductiveautomation.com/u/amy.sudibyo)\
**Post date:** [February 29, 2024, 4:09am UTC](https://forum.inductiveautomation.com/t/named-query-failing-on-gateway-scripting-project/86565/2 "2024-02-29T04:09:36Z")

</div>

I have just been alerted to this thread, seems like a known bug.

Workaround for now just to add project name I guess.

> [@\[IGN-5604\] scoping weirdness after call to system.report functions](https://forum.inductiveautomation.com/t/ign-5604-scoping-weirdness-after-call-to-system-report-functions/81022/12):
>
> Is there a range of affected versions? Or has this been there forever?

---

<div class="post-metadata">

**Author:** ![Neal\_Bunt](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@Neal\_Bunt](https://forum.inductiveautomation.com/u/Neal_Bunt)\
**Post date:** [February 29, 2024, 3:53pm UTC](https://forum.inductiveautomation.com/t/named-query-failing-on-gateway-scripting-project/86565/3 "2024-02-29T15:53:12Z")

</div>

I have just started experiencing this issue as well. Never had a gateway scripting project set, so default value of null. Now I get the same error when trying to run a report. More specifically, it's affecting my script that calls the system.report.executeAndDistribute function, which has always worked up until yesterday.
