Postgresql: "cannot execute nextval() in a read-only transaction"

I am setting up Tracker Capture for case-based surveillance (version 2.30, OpenJDK, Ubuntu 18.04). After initial success I now have an issue where lists of cases do not appear in the Tracker landing page and after registration later stages of the program show only a blank screen.

In the browser JavaScript console I can see 500 errors for the relevant API calls. The error message in the browser is {"httpStatus":"Internal Server Error","httpStatusCode":500,"status":"ERROR","message":"ERROR: cannot execute nextval() in a read-only transaction"}.

A similar “SEVERE” error shows in the logs (attached below as error message is lengthy).

A proposed solution is provided here: but this does not work for me (I have checked that the value of default_transaction_read_only is “off” in the database).

I have just passed several hours of instructive Googling, albeit without finding anything I can do about this.

Would really appreciate any guidance on this. I thought it might have been started by me creating an ID field using a TextPattern with SEQUENTIAL but the problem persists after expunging this.

Thanks, Paul

2019-catalina-errors.docx (16.6 KB)

1 Like

PS this may describe the same issue with 2.30: ERROR: cannot execute nextval() in a read-only transaction

1 Like

Also reported for 2.31 here: but not assigned to anyone yet

1 Like

Solved I think. I was asked by in-country partners to keep an audit trail of tracker data so I enabled the Tracked Entity Instance Audit Log for my main TEI “Case”. Disabling this seems to totally fix my issue.

This is reproducible in the 2.30 version on so I have added a comment to the JIRA issue mentioned above.

From comments I read yesterday which I can’t find now it looks like the tracker audit log code was added to satisfy a requirement of India but doesn’t get much attention now. It is not a particular requirement of my project as I can keep regular backups as a sort of audit trail.

1 Like

I’m having the same issue with Aggregate Data.
I’m using Version
Build revision
Build date
October 19, 2020, 09:50
Jasper reports version