# How to debug generic: \`Error executing system.db.runPrepQuery\` log events

**URL:** <https://forum.inductiveautomation.com/t/how-to-debug-generic-error-executing-system-db-runprepquery-log-events/110248>\
**Category:** Ignition\
**Tags:** database, perspective\
**Created:** [August 28, 2025, 5:42pm UTC](https://forum.inductiveautomation.com/t/how-to-debug-generic-error-executing-system-db-runprepquery-log-events/110248 "2025-08-28T17:42:20Z")\
**Posts on this page:** 1\
**Showing post:** 10

<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:** [August 29, 2025, 12:05am UTC](https://forum.inductiveautomation.com/t/how-to-debug-generic-error-executing-system-db-runprepquery-log-events/110248/10 "2025-08-29T00:05:46Z")

</div>

> [@Jonathon\_Platt](#):
>
> `Select Query	28Aug2025 18:17:51	471.061 [perspective-worker-1033] Java cause: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block`

Well, that's your problem. Postgres is throwing an exception because the transaction isn't live. That's either an explicitly created DB transaction you're passing into the system function, an implicitly created one due to your DB connection properties, or an even higher layer one created by Postgres' local configuration.

> [@Jonathon\_Platt](#):
>
> I did follow on from your idea and logged each line of the stack trace as separate log entries:

Don't do that.  
Ignition's logging system is rich - collapsing errors to one line each is making your future life harder for no benefit.

Reaching to @pturmel's [`later.py`](https://forum.inductiveautomation.com/t/update-gui-via-asynchronous-thread/9666/3) for the `PythonAsJavaException` utility class, you can rewrite your snippet for the same end result with less code:

```python
from java.lang import Throwable

def run(self, database=None, tx=None, syntax=None):
	logger = system.util.getLogger("Select Query")

	time = Query.time()
	try:
		logger.mdcPut("queryTime", time)
		query, params = self.describe(syntax)
		logger.infof(
			"%s (%s) db=%s, tx=%s"
			query, params, database, tx
		)
		return system.db.runPrepQuery(query, params, database, tx)
	except Exception as pythonErr:
		logger.error("Python exception encountered", PythonAsJavaException(pythonErr))
	except Throwable as javaErr:
		logger.error("Java exception encountered", javaErr)
	finally:
		logger.mdcRemove("queryTime")

```

> [@Jonathon\_Platt](#):
>
> Normally I end up downloading and inspecting the log tables in a db viewer but not sure how to post a full stack trace?

I'd recommend you use [Kindling](https://github.com/inductiveautomation/kindling) to view Ignition log files. It's a prebuilt desktop application that fully understands our log file format to give you rich presentation.

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-debug-generic-error-executing-system-db-runprepquery-log-events/110248)._
