Skip to content

加载插件后启动报错 Application startup failed. Exiting. #30

Description

@Agnes4m

启动orm涉及插件"nonebot_plugin_delta_helper"和"nonebot_plugin_memes",任何一个启动了均无法启动

2025-09-04 00:27:49.142 | ERROR | uvicorn:send:121 - Traceback (most recent call last):
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/base.py", line 217, in _catch_revision_errors
yield
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/base.py", line 280, in get_revisions
self.revision_map.get_revisions(id_),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/revision.py", line 542, in get_revisions
return sum([self.get_revisions(id_elem) for id_elem in id_], ())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/revision.py", line 565, in get_revisions
return tuple(
^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/revision.py", line 566, in <genexpr>
self._revision_for_ident(rev_id, branch_label)
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/revision.py", line 637, in _revision_for_ident
raise ResolutionError(
alembic.script.revision.ResolutionError: No such revision or branch 'fc352174a592'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/starlette/routing.py", line 694, in lifespan
async with self.lifespan_context(app) as maybe_state:
File "/usr/lib/python3.12/contextlib.py", line 210, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot/drivers/fastapi.py", line 154, in _lifespan_manager
await self._lifespan.startup()
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot/internal/driver/_lifespan.py", line 66, in startup
await self._run_lifespan_func(self._startup_funcs)
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot/internal/driver/_lifespan.py", line 55, in _run_lifespan_func
await cast(ASYNC_LIFESPAN_FUNC, func)()
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/__init__.py", line 92, in init_orm
await greenlet_spawn(migrate.check, alembic_config)
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 201, in greenlet_spawn
result = context.throw(*sys.exc_info())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/migrate.py", line 562, in check
script.run_env()
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/base.py", line 549, in run_env
util.load_python_file(self.dir, "env.py")
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/templates/generic/env.py", line 82, in <module>
await_only(coro)
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only
return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
value = await result
^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/templates/generic/env.py", line 71, in run_migrations_online
await connection.run_sync(do_run_migrations)
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/sqlalchemy/ext/asyncio/engine.py", line 887, in run_sync
return await greenlet_spawn(
^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 203, in greenlet_spawn
result = context.switch(value)
^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/templates/generic/env.py", line 61, in do_run_migrations
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/runtime/environment.py", line 946, in run_migrations
self.get_context().run_migrations(**kw)
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/runtime/migration.py", line 615, in run_migrations
for step in self._migrations_fn(heads, self):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/migrate.py", line 547, in retrieve_migrations
if set(script.get_revisions(rev)) != set(script.get_revisions("heads")):
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/base.py", line 277, in get_revisions
with self._catch_revision_errors():
File "/usr/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/home/ubuntu/bot/nb2/.venv/lib/python3.12/site-packages/alembic/script/base.py", line 249, in _catch_revision_errors
raise util.CommandError(resolution) from re
alembic.util.exc.CommandError: Can't locate revision identified by 'fc352174a592'
2025-09-04 00:27:49.142 | ERROR | uvicorn:startup:59 - Application startup failed. Exiting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions