• Register
0 votes
103 views

Problem :

I am having hell lot of troubles because of below error message
internalerror: current transaction is aborted, commands ignored until end of transaction block
6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

To get rid of the your error, you need to roll back the last erroneous transaction after you have fixed your code.

e.g.
from django.db import transaction
transaction.rollback()

Now you can use try-except to prevent the error from occurring:

e.g.
from django.db import transaction, DatabaseError
try:
    a.save(
except DatabaseError:
    transaction.rollback()

9 7 4
38,600 points

Related questions

0 votes
1 answer 313 views
313 views
Problem : I am facing a lot of errors with the below message : “DatabaseError: current transaction is aborted, commands ignored until end of transaction block” Whenever I tried to change from the python-psycopg to the python-psycopg2 as my Django project's database engine. My code remains the same, just unable to know where those errors are coming from ?
asked Jan 4, 2020 alecxe 7.5k points
0 votes
1 answer 352 views
352 views
Problem : I am not very sure how can I fix the below issue I have really no idea about why am I facing below error while trying to do the runserver: Performing system checks... System check identified no issues (0 silenced). Unhandled exception in thread ... server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
asked Dec 25, 2019 alecxe 7.5k points
0 votes
1 answer 13 views
13 views
Problem: I need someone’s help to fix it .. error pg_config executable not found
asked Mar 19 Ifra 24.4k points
0 votes
1 answer 98 views
98 views
Problem: Facing this error message: Unchecked runtime.lasterror: could not establish connection. receiving end does not exist.
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 2K views
2K views
Problem : I had recently uninstalled the Postgres10 and after that reinstalled the Postgres10. After that I went to run a Node, Express, React application that relies on connecting to a Postgres10 database and also communicates with it using Sequelize. Initially I was unable to ... app at in the browser. Does anyone have any idea what is going wrong? Please suggest me the solution for my error.
asked Nov 22, 2019 peterlaw 6.9k points
0 votes
1 answer 8 views
8 views
Problem: I work on a small Django app and get an error tell me: Super(type, obj): obj must be an instance or subtype of type Can someone explain the reason for the error to me and how to solve it?
asked Mar 22 ummesalma 24.5k points
0 votes
1 answer 7 views
7 views
Problem: What is the point of using an else clause if there is a return instruction in the except clause? Thanks in advance
asked Mar 14 ummesalma 24.5k points
1 vote
1 answer 130 views
130 views
Problem: I have fundamental knowledge of Django. I have learned Django with the help of online tutorials. Recently I have started working on Django. I have recently tried to upgrade my Django to the Django 1.10. Since then I am often facing below error: TypeError: ... ), ] I have only fundamental knowledge about Django so unable to fix the above error. Kindly help me in fixing above Django error.
asked Jun 8, 2020 Martin K 6.6k points
0 votes
2 answers 651 views
651 views
Problem : After upgrading it to Django 1.10, I get below error: “TypeError: view must be a callable or a list/tuple in the case of include().” My urls.py is as below : from django.conf.urls import include, url urlpatterns = [     url(r'^$', 'myapp.views.home' ... r'^contact/$', 'myapp.views.contact'),     url(r'^login/$', 'django.contrib.auth.views.login'), ] How can I fix above error?
asked Jan 23, 2020 jwilliam 3.9k points
0 votes
1 answer 7 views
7 views
Problem: Can anyone tell me that is not a valid view function or pattern name?
asked Apr 1 Ifra 24.4k points