IntegrityError sqlalchemy.engine.default in do_execute

206 views
Skip to first unread message

Vitor Freire

unread,
Aug 24, 2021, 11:53:29 AM8/24/21
to oTree help & discussion
Hi Chris,

Yesterday I experienced and error with an user during a session. Checking the information on Sentry add-on I got the following. Any idea of what might have caused it?
I saw that this error originates from the database but no idea how to address it.

"
UniqueViolation: duplicate key value violates unique constraint "pg_type_typname_nsp_index" DETAIL: Key (typname, typnamespace)=(models_concrete_pagetimebatch_id_seq, 2200) already exists. File "sqlalchemy/engine/base.py", line 1276, in _execute_context self.dialect.do_execute( File "sqlalchemy/engine/default.py", line 609, in do_execute cursor.execute(statement, parameters)
IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "pg_type_typname_nsp_index" DETAIL: Key (typname, typnamespace)=(models_concrete_pagetimebatch_id_seq, 2200) already exists. [SQL: CREATE TABLE models_concrete_pagetimebatch ( id SERIAL NOT NULL, text TEXT, PRIMARY KEY (id)
)

 ] (Background on this error at: http://sqlalche.me/e/13/gkpj) File "otree", line 8, in <module> sys.exit(execute_from_command_line()) File "otree/main.py", line 106, in execute_from_command_line setup() File "otree/main.py", line 140, in setup init_orm() File "otree/database.py", line 321, in init_orm AnyModel.metadata.create_all(engine) File "sqlalchemy/sql/schema.py", line 4553, in create_all bind._run_visitor( File "sqlalchemy/engine/base.py", line 2095, in _run_visitor conn._run_visitor(visitorcallable, element, **kwargs) File "sqlalchemy/engine/base.py", line 1656, in _run_visitor visitorcallable(self.dialect, self, **kwargs).traverse_single(element) File "sqlalchemy/sql/visitors.py", line 145, in traverse_single return meth(obj, **kw) File "sqlalchemy/sql/ddl.py", line 783, in visit_metadata self.traverse_single( File "sqlalchemy/sql/visitors.py", line 145, in traverse_single return meth(obj, **kw) File "sqlalchemy/sql/ddl.py", line 827, in visit_table self.connection.execute( File "sqlalchemy/engine/base.py", line 1011, in execute return meth(self, multiparams, params) File "sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection return connection._execute_ddl(self, multiparams, params) File "sqlalchemy/engine/base.py", line 1068, in _execute_ddl ret = self._execute_context( File "sqlalchemy/engine/base.py", line 1316, in _execute_context self._handle_dbapi_exception( File "sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception util.raise_( File "sqlalchemy/util/compat.py", line 182, in raise_ raise exception File "sqlalchemy/engine/base.py", line 1276, in _execute_context self.dialect.do_execute( File "sqlalchemy/engine/default.py", line 609, in do_execute cursor.execute(statement, parameters)
"

Chris @ oTree

unread,
Aug 24, 2021, 12:00:42 PM8/24/21
to Vitor Freire, oTree help & discussion
Were you running multiple web dynos? That could cause this issue. 

Otherwise, I’ll take a look at this and see if I have any ideas. How many times did it occur? Was the user stuck or could they refresh the page ?

Sent from my phone

On Aug 24, 2021, at 9:53 AM, Vitor Freire <vit...@gmail.com> wrote:

Hi Chris,
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/46c92000-7709-47e9-8017-5d0729a0e7d5n%40googlegroups.com.

Vitor Freire (vitorbsfreire@gmail.com)

unread,
Aug 24, 2021, 1:07:29 PM8/24/21
to Chris @ oTree, oTree help & discussion
I was running 1 dyno and 1 worker at the Standard-1X plan. There were 24 users, grouped in 8 groups of three.
The user could refresh and follow on.
Reply all
Reply to author
Forward
0 new messages