Error searching for a record

I recently started getting the following error message:

File "/home/tecnocarnes01/.venv/tryton/lib/python3.9/site-packages/trytoncdst_conector-6.0.2-py3.9.egg/trytond/modules/conector/configuration.py", line 59, in conexion
    last_record = Config.search([], order=[('id', 'DESC')], limit=1)
  File "/home/tecnocarnes01/.venv/tryton/lib/python3.9/site-packages/trytond/model/modelsql.py", line 1342, in search
    cursor.execute(*select)
  File "/home/tecnocarnes01/.venv/tryton/lib/python3.9/site-packages/trytond/backend/postgresql/database.py", line 72, in execute
    cursor.execute(self, sql, args)
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block

I understand that the error originates from the following part of the code:

        Config = Pool().get('conector.configuration')
        last_record = Config.search([], order=[('id', 'DESC')], limit=1)
        if last_record:
            record, = last_record

Thanks to anyone who can help me identify the problem.

It looks like you have catch a Database error and keep using the same connection/transaction.
Tryton uses repeatable read isolation level. This level can not be guarantee if there was a database error.

Correct, I had try except in that part of the code and that is why the UserError was not shown