Traceback (most recent call last):
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/werkzeug/wsgi.py", line 659, in __call__
return app(environ, start_response)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request
return view_func(**req.view_args)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/views/client.py", line 129, in authorized
return current_oauthclient.handlers[remote_app]()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/flask_oauthlib/client.py", line 647, in decorated
return f(*((data,) + args), **kwargs)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/handlers.py", line 426, in inner
return f(args[0], remote, *args[1:], **kwargs)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/handlers.py", line 181, in inner
return f(*args, **kwargs)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/handlers.py", line 222, in authorized_signup_handler
token = response_token_setter(remote, resp)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/handlers.py", line 71, in response_token_setter
return oauth2_token_setter(remote, resp)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/handlers.py", line 106, in oauth2_token_setter
extra_data=extra_data,
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/handlers.py", line 130, in token_setter
token_type=token_type, extra_data=extra_data
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/invenio_oauthclient/models.py", line 217, in create
db.session.add(token)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 490, in __exit__
self.rollback()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
raise value
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 487, in __exit__
self.commit()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 392, in commit
self._prepare_impl()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
self.session.flush()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2019, in flush
self._flush(objects)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2137, in _flush
transaction.rollback(_capture_exception=True)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
raise value
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2101, in _flush
flush_context.execute()
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
rec.execute(self)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 532, in execute
uow
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 174, in save_obj
mapper, table, insert)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 800, in _emit_insert_statements
execute(statement, params)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
compiled_sql, distilled_params
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
exc_info
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 185, in reraise
raise value.with_traceback(tb)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "/Users/lnielsen/envs/zenoodo/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.IntegrityError) duplicate key value violates unique constraint "oauthclient_remoteaccount_pkey"
DETAIL: Key (id)=(3) already exists.
[SQL: 'INSERT INTO oauthclient_remoteaccount (user_id, client_id, extra_data) VALUES (%(user_id)s, %(client_id)s, %(extra_data)s) RETURNING oauthclient_remoteaccount.id'] [parameters: {'user_id': 176, 'client_id': '…….', 'extra_data': '{}'}]
Reproduce: