# \[BUG\] system.db.clearNamedQueryCache doesn't raise exception for invalid path

**URL:** <https://forum.inductiveautomation.com/t/bug-system-db-clearnamedquerycache-doesnt-raise-exception-for-invalid-path/104499>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [April 1, 2025, 9:47am UTC](https://forum.inductiveautomation.com/t/bug-system-db-clearnamedquerycache-doesnt-raise-exception-for-invalid-path/104499 "2025-04-01T09:47:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![VinceV](https://avatars.discourse-cdn.com/v4/letter/v/bb73d2/32.png) [@VinceV](https://forum.inductiveautomation.com/u/VinceV)\
**Post date:** [April 1, 2025, 9:47am UTC](https://forum.inductiveautomation.com/t/bug-system-db-clearnamedquerycache-doesnt-raise-exception-for-invalid-path/104499/1 "2025-04-01T09:47:42Z")

</div>

Title.

This function also seems to have a _void_ return so there is no feedback whatsoever on whether this function executed successfully or whether any cache was actually cleared.

According to the javadoc, this function should throw a GatewayException if the path is malformed, but it does not.

Tested in browser from a perspective view:

```py
def runAction(self, event):
	system.perspective.print("start test")
	from java.lang import Throwable
	
	try:
		ret = system.db.clearNamedQueryCache(path = "blablabla")
		system.perspective.print("ret: %s" % (repr(ret)))
	except Throwable as t:
		system.perspective.print("caught Throwable: %s" % (repr(t)))
	except Exception as e:
		system.perspective.print("caught Exception: %s" % (repr(e)))
	
	system.perspective.print("end test")
	self.props.value = 0

```

Expected output: "caught Throwable"

Acutal output:

 ![afbeelding](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/1/a1f4630b3b477cb8bf998e8f0f3fa9c8fdc9b8c1.png)

> **View JSON**
>
> ```json
> {
> "custom": {},
> "params": {},
> "props": {
> "defaultSize": {
> "height": 500,
> "width": 700
> }
> },
> "root": {
> "children": [
> {
> "meta": {
> "name": "TextArea"
> },
> "position": {
> "basis": "160px",
> "grow": 1
> },
> "props": {
> "text": "---\nNone\n---\n"
> },
> "type": "ia.input.text-area"
> },
> {
> "events": {
> "component": {
> "onActionPerformed": {
> "config": {
> "script": "\tsystem.perspective.print(\"start test\")\n\tfrom java.lang import Throwable\n\t\n\ttry:\n\t\tret \u003d system.db.clearNamedQueryCache(path \u003d \"blablabla\")\n\t\tsystem.perspective.print(\"ret: %s\" % (repr(ret)))\n\texcept Throwable as t:\n\t\tsystem.perspective.print(\"caught Throwable: %s\" % (repr(t)))\n\texcept Exception as e:\n\t\tsystem.perspective.print(\"caught Exception: %s\" % (repr(e)))\n\t\n\tsystem.perspective.print(\"end test\")\n\tself.props.value \u003d 0\n\t"
> },
> "scope": "G",
> "type": "script"
> }
> }
> },
> "meta": {
> "name": "OneShotButton"
> },
> "position": {
> "basis": "34px"
> },
> "props": {
> "readyState": {
> "icon": {
> "style": {
> "height": "24px",
> "width": "2rem"
> }
> },
> "text": "Run"
> },
> "writingState": {
> "icon": {
> "path": "material/hourglass_empty",
> "style": {
> "height": "24px",
> "width": "2rem"
> }
> },
> "text": "Busy..."
> }
> },
> "type": "ia.input.oneshotbutton"
> }
> ],
> "meta": {
> "name": "root"
> },
> "props": {
> "direction": "column"
> },
> "type": "ia.container.flex"
> }
> }
> 
> ```

---

<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:** [April 1, 2025, 12:04pm UTC](https://forum.inductiveautomation.com/t/bug-system-db-clearnamedquerycache-doesnt-raise-exception-for-invalid-path/104499/2 "2025-04-01T12:04:00Z")

</div>

Try with path as a positional parameter. The docs do not say that this function accepts keyword parameters.

---

<div class="post-metadata">

**Author:** ![VinceV](https://avatars.discourse-cdn.com/v4/letter/v/bb73d2/32.png) [@VinceV](https://forum.inductiveautomation.com/u/VinceV)\
**Post date:** [April 1, 2025, 12:52pm UTC](https://forum.inductiveautomation.com/t/bug-system-db-clearnamedquerycache-doesnt-raise-exception-for-invalid-path/104499/3 "2025-04-01T12:52:50Z")

</div>

Good suggestion but alas, it has no effect. It produces the exact same result as above. I don't think I've ever had problems passing keyword arguments to `system.db` functions.

---

<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:** [April 1, 2025, 12:59pm UTC](https://forum.inductiveautomation.com/t/bug-system-db-clearnamedquerycache-doesnt-raise-exception-for-invalid-path/104499/4 "2025-04-01T12:59:47Z")

</div>

Oh, well.

( A lot of older functions do not play well with keyword arguments. )

---

<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:** [April 1, 2025, 3:59pm UTC](https://forum.inductiveautomation.com/t/bug-system-db-clearnamedquerycache-doesnt-raise-exception-for-invalid-path/104499/5 "2025-04-01T15:59:07Z")

</div>

Yeah. The docs/function are just wrong; maybe the implementation changed over time and nobody caught it, but it's not going to throw if you pass it garbage. Unfortunately, it's `void` all the way down, even the internal Java methods, so there's nothing for the scripting function to return either.
