# Error searching for a record

**URL:** https://discuss.tryton.org/t/error-searching-for-a-record/5460
**Category:** Developer
**Created:** [August 9, 2022, 10:18pm UTC](https://discuss.tryton.org/t/error-searching-for-a-record/5460 "2022-08-09T22:18:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lancheros](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@lancheros](https://discuss.tryton.org/u/lancheros)
#### Post date: [August 9, 2022, 10:18pm UTC](https://discuss.tryton.org/t/error-searching-for-a-record/5460/1 "2022-08-09T22:18:46Z")

</div>

I recently started getting the following error message:

```auto
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:

```auto
        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.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [August 10, 2022, 6:21am UTC](https://discuss.tryton.org/t/error-searching-for-a-record/5460/2 "2022-08-10T06:21:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lancheros](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@lancheros](https://discuss.tryton.org/u/lancheros)
#### Post date: [August 10, 2022, 1:50pm UTC](https://discuss.tryton.org/t/error-searching-for-a-record/5460/3 "2022-08-10T13:50:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [September 9, 2022, 1:50pm UTC](https://discuss.tryton.org/t/error-searching-for-a-record/5460/4 "2022-09-09T13:50:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
