mrphlip/lrrbot

lrrbot.main.LRRBot.get_game_id: sqlalchemy.exc.IntegrityError: (psycopg2.IntegrityError) duplicate key value violates unique constraint "games_pkey"

Closed this issue · 0 comments

[2017-05-09 19:31:09,174] ERROR:www.server:Exception on / [GET]
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib64/python3.5/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib64/python3.5/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib64/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/lib64/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib64/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "./www/server.py", line 24, in inner
    return asyncio.get_event_loop().run_until_complete(view_func(*args, **kwargs))
  File "/usr/lib64/python3.5/asyncio/base_events.py", line 466, in run_until_complete
    return future.result()
  File "/usr/lib64/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib64/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "./www/login.py", line 56, in wrapper
    kwargs['session'] = await load_session()
  File "./www/login.py", line 148, in load_session
    session['header'] = await common.rpc.bot.get_header_info()
  File "./common/rpc.py", line 56, in __call__
    return await node(*args, **kwargs)
  File "/usr/lib64/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib64/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib64/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
aiomas.exceptions.RemoteException: Origin: lrrbot.sock
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/default.py", line 462, in do_execute
    cursor.execute(statement, parameters)
psycopg2.IntegrityError: duplicate key value violates unique constraint "games_pkey"
DETAIL:  Key (id)=(488946) already exists.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/aiomas/rpc.py", line 159, in _handle_request
    res = func(*args, **kwargs)
  File "/srv/lrrbot/lrrbot/lrrbot/rpc.py", line 90, in get_header_info
    game_id = self.lrrbot.get_game_id()
  File "/srv/lrrbot/lrrbot/common/utils.py", line 103, in decorated_func
    next(x)
  File "/srv/lrrbot/lrrbot/common/utils.py", line 171, in wrapper
    self.lastreturn[params] = yield from func(*args, **kwargs)
  File "/usr/lib64/python3.5/asyncio/coroutines.py", line 210, in coro
    res = func(*args, **kw)
  File "/srv/lrrbot/lrrbot/lrrbot/main.py", line 330, in get_game_id
    "name": game_name
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/base.py", line 1393, in _handle_dbapi_exception
    exc_info
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/util/compat.py", line 185, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/lib64/python3.5/site-packages/sqlalchemy/engine/default.py", line 462, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.IntegrityError) duplicate key value violates unique constraint "games_pkey"
DETAIL:  Key (id)=(488946) already exists.
 [SQL: 'INSERT INTO games (id, name) VALUES (%(id)s, %(name)s)'] [parameters: {'name': 'STRAFE', 'id': 488946}]

I manually updated the database with the new name.