KimigaiiWuyi / GenshinUID

支持OneBot(QQ)、OneBotV12、QQ频道、微信、KOOK(开黑啦)、Telegram(电报)、FeiShu(飞书)、DoDo、Villa(米游社大别野)、Discord的全功能HoshinoBot/NoneBot2/Koishi/yunzai/ZeroBot原神机器人插件
https://docs.sayu-bot.com
GNU General Public License v3.0
742 stars 101 forks source link

绑定uid报错 #569

Closed SeeWhyRan closed 1 year ago

SeeWhyRan commented 1 year ago

07-19 01:47:10 [INFO] gsuid_core.handler | [Raw] raw_text=绑定uid217435479, image=None, at=None, image_list=None, at_list=[], is_tome=False, reply=None, file_name=None, file_type=None, file=None | [Receive] bot_id=onebot, bot_self_id=2711301284, msg_id=-334290022, user_type=group, group_id=586671981, user_id=1264405841, user_pm=2, content=[Message(type='text', data='绑定uid217435479')],
07-19 01:47:10 [INFO] gsuid_core.handler | [Trigger] 消息 「绑定uid217435479」 触发 「command」 类型触发器, 关键词: 「绑定uid」
07-19 01:47:10 [INFO] gsuid_core.handler | [Command] command=绑定uid, text=217435479 Task exception was never retrieved future: <Task finished name='Task-608' coro=<send_link_uid_msg() done, defined at /home/ubuntu/nonebots/gsuid_core/gsuid_core/plugins/GenshinUID/GenshinUID/genshinuid_user/init.py:16> exception=IntegrityError('(sqlite3.IntegrityError) NOT NULL constraint failed: gsbind.group_id')> Traceback (most recent call last): File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 100, in execute self._adapt_connection._handle_exception(error) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 228, in _handleexception raise error File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 82, in execute self.await(_cursor.execute(operation, parameters)) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 68, in await_only return current.driver.switch(awaitable) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 121, in greenlet_spawn value = await result File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 48, in execute await self._execute(self._cursor.execute, sql, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 40, in _execute return await self._conn._execute(fn, *args, **kwargs) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 133, in _execute return await future File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 106, in run result = function() sqlite3.IntegrityError: NOT NULL constraint failed: gsbind.group_id

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

Traceback (most recent call last): File "/home/ubuntu/nonebots/gsuid_core/gsuid_core/plugins/GenshinUID/GenshinUID/genshinuid_user/init.py", line 28, in send_link_uid_msg data = await sqla.insert_bind_data(qid, uid=uid) File "/home/ubuntu/nonebots/gsuid_core/gsuid_core/utils/database/dal.py", line 107, in insert_bind_data await session.commit() File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/ext/asyncio/session.py", line 583, in commit return await greenlet_spawn(self.sync_session.commit) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 128, in greenlet_spawn result = context.switch(value) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1451, in commit self._transaction.commit(_to_root=self.future) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 829, in commit self._prepare_impl() File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 808, in _prepare_impl self.session.flush() File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 3386, in flush self._flush(objects) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 3525, in _flush with util.safereraise(): File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 70, in exit compat.raise( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 3486, in _flush flush_context.execute() File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute rec.execute(self) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute util.preloaded.orm_persistence.save_obj( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj _emit_insert_statements( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 1238, in _emit_insert_statements result = connection._execute_20( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 333, in _execute_on_connection return connection._execute_clauseelement( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement ret = self._execute_context( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context self._handle_dbapi_exception( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapiexception util.raise( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 100, in execute self._adapt_connection._handle_exception(error) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 228, in _handleexception raise error File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 82, in execute self.await(_cursor.execute(operation, parameters)) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 68, in await_only return current.driver.switch(awaitable) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 121, in greenlet_spawn value = await result File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 48, in execute await self._execute(self._cursor.execute, sql, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 40, in _execute return await self._conn._execute(fn, *args, **kwargs) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 133, in _execute return await future File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 106, in run result = function() sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: gsbind.group_id [SQL: INSERT INTO gsbind (bot_id, user_id, group_id, uid, sr_uid, mys_id) VALUES (?, ?, ?, ?, ?, ?)] [parameters: ('onebot', '1264405841', None, '217435479', None, None)] (Background on this error at: https://sqlalche.me/e/14/gkpj)

SeeWhyRan commented 1 year ago

上面的是gsuid_core那边的报错信息,下面是nonebot2的 07-19 01:47:10 [SUCCESS] nonebot | OneBot V11 2711301284 | [message.group.normal]: Message -334290022 from 1264405841@[群:586671981] '绑定uid217435479' 07-19 01:47:10 [DEBUG] nonebot | Checking for matchers in priority 1... 07-19 01:47:10 [DEBUG] nonebot | Checking for matchers in priority 4... 07-19 01:47:10 [DEBUG] nonebot | Checking for matchers in priority 5... 07-19 01:47:10 [DEBUG] nonebot | Checking for matchers in priority 10... 07-19 01:47:10 [DEBUG] nonebot | Checking for matchers in priority 12... 07-19 01:47:10 [DEBUG] nonebot | Checking for matchers in priority 999... 07-19 01:47:10 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.GenshinUID.GenshinUID) 07-19 01:47:10 [DEBUG] nonebot | Running Matcher(type='message', module=src.plugins.GenshinUID.GenshinUID) 07-19 01:47:10 [DEBUG] nonebot | Running handler Dependent(call=get_all_message) 07-19 01:47:10 [DEBUG] GenshinUID | [message.group.normal]: Message -334290022 from 1264405841@[群:586671981] '绑定uid217435479' 07-19 01:47:10 [INFO] GenshinUID | 【发送】[gsuid-core]: onebot 07-19 01:47:10 [INFO] nonebot | Matcher(type='message', module=src.plugins.GenshinUID.GenshinUID) running complete 07-19 01:47:10 [DEBUG] nonebot | Stop event propagation 07-19 01:47:10 [DEBUG] nonebot | Checking for matchers completed 07-19 01:47:10 [INFO] client | 【接收】[gsuid-core]: NoneBot2 - None - None 07-19 01:47:10 [INFO] client | 开始执行[绑定/解绑用户信息] 07-19 01:47:10 [INFO] client | 【接收】[gsuid-core]: NoneBot2 - None - None 07-19 01:47:10 [INFO] client | [绑定/解绑]UserID: 1264405841

系统:Ubuntu Server 22.04 LTS 64bit,python版本3.10.6

KimigaiiWuyi commented 1 year ago

新部署的core么,更新core后删除gsuid_core/Gs_data.db后重新打开重试

SeeWhyRan commented 1 year ago

是新部署的core。 感谢,问题已解决,不过现在启动core时会报错 `07-19 12:19:22 [INFO] gsuid_core.sv | 载入fullmatch触发器【Core帮助】! 07-19 12:19:22 [INFO] gsuid_core.sv | 载入fullmatch触发器【core更新】! 07-19 12:19:22 [INFO] gsuid_core.sv | 载入fullmatch触发器【core更新依赖】! 07-19 12:19:22 [INFO] gsuid_core.sv | 载入fullmatch触发器【core全部更新】! 07-19 12:19:22 [INFO] GenshinUID.GenshinUID.utils.resource.download_from_miniggicu | [minigg.icu]数据库[角色名片]中存在55个内容! Task exception was never retrieved future: <Task finished name='Task-3' coro=<SQLA._create_all() done, defined at /home/ubuntu/nonebots/gsuid_core/gsuid_core/utils/database/dal.py:35> exception=OperationalError('(sqlite3.OperationalError) table gsbind already exists')> Traceback (most recent call last): File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 100, in execute self._adapt_connection._handle_exception(error) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 228, in _handleexception raise error File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 82, in execute self.await(_cursor.execute(operation, parameters)) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 68, in await_only return current.driver.switch(awaitable) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 121, in greenlet_spawn value = await result File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 48, in execute await self._execute(self._cursor.execute, sql, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 40, in _execute return await self._conn._execute(fn, *args, **kwargs) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 133, in _execute return await future File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 106, in run result = function() sqlite3.OperationalError: table gsbind already exists

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

Traceback (most recent call last): File "/home/ubuntu/nonebots/gsuid_core/gsuid_core/utils/database/dal.py", line 37, in _create_all await conn.run_sync(SQLModel.metadata.create_all) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/ext/asyncio/engine.py", line 548, in run_sync return await greenlet_spawn(fn, conn, *arg, kw) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 126, in greenlet_spawn result = context.throw(*sys.exc_info()) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/sql/schema.py", line 4917, in create_all bind._run_ddl_visitor( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2211, in _run_ddl_visitor visitorcallable(self.dialect, self, kwargs).traverse_single(element) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py", line 524, in traverse_single return meth(obj, kw) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 851, in visit_metadata self.traverse_single( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py", line 524, in traverse_single return meth(obj, *kw) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 895, in visit_table self.connection.execute( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/future/engine.py", line 280, in execute return self._execute_20( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py", line 80, in _execute_on_connection return connection._execute_ddl( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1472, in _execute_ddl ret = self._execute_context( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context self._handle_dbapi_exception( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapiexception util.raise( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 100, in execute self._adapt_connection._handle_exception(error) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 228, in _handleexception raise error File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 82, in execute self.await(_cursor.execute(operation, parameters)) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 68, in await_only return current.driver.switch(awaitable) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 121, in greenlet_spawn value = await result File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 48, in execute await self._execute(self._cursor.execute, sql, parameters) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/cursor.py", line 40, in _execute return await self._conn._execute(fn, args, kwargs) File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 133, in _execute return await future File "/home/ubuntu/myenv/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 106, in run result = function() sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table gsbind already exists [SQL: CREATE TABLE gsbind ( id INTEGER NOT NULL, bot_id VARCHAR NOT NULL, user_id VARCHAR NOT NULL, group_id VARCHAR, uid VARCHAR, sr_uid VARCHAR, mys_id VARCHAR, PRIMARY KEY (id) )

] (Background on this error at: https://sqlalche.me/e/14/e3q8) 07-19 12:19:22 [INFO] GenshinUID.GenshinUID.utils.resource.download_from_miniggicu | [minigg.icu]数据库[角色名片]中存在55个内容! 07-19 12:19:22 [INFO] GenshinUID.GenshinUID.utils.resource.download_from_miniggicu | [minigg.icu]下载完成! 07-19 12:19:22 [INFO] GenshinUID.GenshinUID.utils.resource.download_from_miniggicu | [minigg.icu]数据库[角色名片]无需下载! 07-19 12:19:22 [INFO] GenshinUID.GenshinUID.utils.resource.download_from_miniggicu | [minigg.icu]下载完成! 07-19 12:19:22 [INFO] GenshinUID.GenshinUID.utils.resource.download_from_miniggicu | [minigg.icu]数据库[角色名片]无需下载! 07-19 12:19:22 [INFO] GenshinUID.GenshinUID.uti` 请问这个是正常的吗?

KimigaiiWuyi commented 1 year ago

没事 不影响使用,我后期修复

SeeWhyRan commented 1 year ago

好的,再次感谢大佬