ERROR [CTFd] Exception on /api/v1/challenges/attempt [POST]
Traceback (most recent call last):
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1905, in _execute_context
self.dialect.do_execute(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
File "/opt/venv/lib/python3.9/site-packages/pymysql/cursors.py", line 148, in execute
result = self._query(query)
File "/opt/venv/lib/python3.9/site-packages/pymysql/cursors.py", line 310, in _query
conn.query(q)
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 775, in _read_query_result
result.read()
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 725, in _read_packet
packet.raise_for_error()
File "/opt/venv/lib/python3.9/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/opt/venv/lib/python3.9/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, "Duplicate entry '3351-1425' for key 'challenge_id_2'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/venv/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/venv/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/opt/venv/lib/python3.9/site-packages/flask_restx/api.py", line 404, in wrapper
resp = resource(*args, **kwargs)
File "/opt/venv/lib/python3.9/site-packages/flask/views.py", line 107, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs)
File "/opt/venv/lib/python3.9/site-packages/flask_restx/resource.py", line 46, in dispatch_request
resp = meth(*args, **kwargs)
File "/opt/CTFd/CTFd/utils/decorators/visibility.py", line 60, in _check_challenge_visibility
return f(*args, **kwargs)
File "/opt/CTFd/CTFd/utils/decorators/__init__.py", line 23, in during_ctf_time_only_wrapper
return f(*args, **kwargs)
File "/opt/CTFd/CTFd/utils/decorators/__init__.py", line 75, in _require_verified_emails
return f(*args, **kwargs)
File "/opt/CTFd/CTFd/api/v1/challenges.py", line 624, in post
chal_class.solve(
File "/opt/CTFd/CTFd/plugins/dojo_plugin/__init__.py", line 45, in solve
super().solve(user, team, challenge, request)
File "/opt/CTFd/CTFd/plugins/challenges/__init__.py", line 151, in solve
db.session.commit()
File "<string>", line 2, in commit
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1454, in commit
self._transaction.commit(_to_root=self.future)
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 832, in commit
self._prepare_impl()
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 811, in _prepare_impl
self.session.flush()
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3449, in flush
self._flush(objects)
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3589, in _flush
transaction.rollback(_capture_exception=True)
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
compat.raise_(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3549, in _flush
flush_context.execute()
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
rec.execute(self)
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute
util.preloaded.orm_persistence.save_obj(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj
_emit_insert_statements(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1097, in _emit_insert_statements
c = connection._execute_20(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
return connection._execute_clauseelement(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
ret = self._execute_context(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1948, in _execute_context
self._handle_dbapi_exception(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2129, in _handle_dbapi_exception
util.raise_(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1905, in _execute_context
self.dialect.do_execute(
File "/opt/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
File "/opt/venv/lib/python3.9/site-packages/pymysql/cursors.py", line 148, in execute
result = self._query(query)
File "/opt/venv/lib/python3.9/site-packages/pymysql/cursors.py", line 310, in _query
conn.query(q)
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 775, in _read_query_result
result.read()
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "/opt/venv/lib/python3.9/site-packages/pymysql/connections.py", line 725, in _read_packet
packet.raise_for_error()
File "/opt/venv/lib/python3.9/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/opt/venv/lib/python3.9/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.IntegrityError: (pymysql.err.IntegrityError) (1062, "Duplicate entry '3351-1425' for key 'challenge_id_2'")
[SQL: INSERT INTO solves (id, challenge_id, user_id, team_id) VALUES (%(id)s, %(challenge_id)s, %(user_id)s, %(team_id)s)]
[parameters: {'id': 1877814, 'challenge_id': 3351, 'user_id': 1425, 'team_id': None}]
(Background on this error at: https://sqlalche.me/e/14/gkpj)