alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.56k stars 223 forks source link

🐛 [Mealie] Error when starting braking after upgrading from 1.12.0-2 to 1.12.0-4 #1583

Closed jack5mikemotown closed 1 month ago

jack5mikemotown commented 1 month ago

Description

After upgrading versions, I get the below error when starting mealie. Downgrading back to 1.12.0-2 restored mealie to a functional state.

The only possibly relevant context I can think to add, is that I was able to bypass the issue with 1.12 by downgrading to the prior working version, restoring my mealie files in HA and upgrading to the fixed version.

Reproduction steps

1. Upgrade mealie to 1.12.0-4
2. Press start
3. Get error

Addon Logs

raise ResolutionError(
alembic.script.revision.ResolutionError: No such revision or branch 'feecc8ffb956'

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

Traceback (most recent call last):
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 732, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/app/mealie/app.py", line 55, in lifespan_fn
    init_db.main()
  File "/app/mealie/db/init_db.py", line 101, in main
    command.upgrade(alembic_cfg, "head")
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 406, in upgrade
    script.run_env()
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 582, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
    module = load_module_py(module_id, path)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app/alembic/env.py", line 81, in <module>
    run_migrations_online()
  File "/app/alembic/env.py", line 75, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/environment.py", line 946, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/migration.py", line 616, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 395, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 446, in _upgrade_revs
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 814, in iterate_revisions
    revisions, heads = fn(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 1475, in _collect_upgrade_revisions
    current_revisions = self.get_revisions(lower)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 542, in get_revisions
    return sum([self.get_revisions(id_elem) for id_elem in id_], ())
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 542, in <listcomp>
    return sum([self.get_revisions(id_elem) for id_elem in id_], ())
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 565, in get_revisions
    return tuple(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 566, in <genexpr>
    self._revision_for_ident(rev_id, branch_label)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 637, in _revision_for_ident
    raise ResolutionError(
alembic.script.revision.ResolutionError: No such revision or branch 'feecc8ffb956'

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

Traceback (most recent call last):
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 732, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/app/mealie/app.py", line 55, in lifespan_fn
    init_db.main()
  File "/app/mealie/db/init_db.py", line 101, in main
    command.upgrade(alembic_cfg, "head")
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 406, in upgrade
    script.run_env()
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 582, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
    module = load_module_py(module_id, path)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
    with self._catch_revision_errors(
  File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 282, in _catch_revision_errors
    raise util.CommandError(resolution) from re
alembic.util.exc.CommandError: Can't locate revision identified by 'feecc8ffb956'

ERROR    2024-09-24T01:10:17 - Application startup failed. Exiting.
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app/alembic/env.py", line 81, in <module>
    run_migrations_online()
  File "/app/alembic/env.py", line 75, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/environment.py", line 946, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/migration.py", line 616, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 395, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 446, in _upgrade_revs
    with self._catch_revision_errors(
  File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 282, in _catch_revision_errors
    raise util.CommandError(resolution) from re
alembic.util.exc.CommandError: Can't locate revision identified by 'feecc8ffb956'

ERROR    2024-09-24T01:10:17 - Application startup failed. Exiting.

Architecture

amd64

OS

HAos, Virtual Machine

alexbelgium commented 1 month ago

Argh this is such a mess. I'll try to force using the last dev image that was used to build 1.12.0-2, prior the shift in Mealie to the 2.0 database. Hope it will work

alexbelgium commented 1 month ago

Edit : actually I can't - Mealie is overwritting their dev container each time... So I can't go back to a previous version. I'll push back again 1.12.0-2 for the moment...

webb64b commented 1 month ago

I am running into the same issue Here is my log ` File "", line 241, in _call_with_frames_removed File "/app/alembic/env.py", line 81, in run_migrations_online() File "/app/alembic/env.py", line 75, in run_migrations_online context.run_migrations() File "", line 8, in run_migrations File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/environment.py", line 946, in run_migrations self.get_context().run_migrations(**kw) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/migration.py", line 616, in run_migrations for step in self._migrations_fn(heads, self): File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 395, in upgrade return script._upgrade_revs(revision, rev) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 446, in _upgrade_revs with self._catch_revision_errors( File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 282, in _catch_revision_errors raise util.CommandError(resolution) from re alembic.util.exc.CommandError: Can't locate revision identified by 'feecc8ffb956'

ERROR 2024-09-24T13:16:00 - Traceback (most recent call last): File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 250, in _catch_revision_errors yield File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 458, in _upgrade_revs for script in reversed(list(revs)) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 814, in iterate_revisions revisions, heads = fn( File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 1475, in _collect_upgrade_revisions current_revisions = self.get_revisions(lower) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 542, in get_revisions return sum([self.get_revisions(id_elem) for idelem in id], ()) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 542, in return sum([self.get_revisions(id_elem) for idelem in id], ()) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 565, in get_revisions return tuple( File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 566, in self._revision_for_ident(rev_id, branch_label) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/revision.py", line 637, in _revision_for_ident raise ResolutionError( alembic.script.revision.ResolutionError: No such revision or branch 'feecc8ffb956'

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

Traceback (most recent call last): File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 732, in lifespan async with self.lifespan_context(app) as maybe_state: File "/usr/local/lib/python3.10/contextlib.py", line 199, in aenter return await anext(self.gen) File "/app/mealie/app.py", line 55, in lifespan_fn init_db.main() File "/app/mealie/db/init_db.py", line 101, in main command.upgrade(alembic_cfg, "head") File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 406, in upgrade script.run_env() File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 582, in run_env util.load_python_file(self.dir, "env.py") File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file module = load_module_py(module_id, path) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py spec.loader.exec_module(module) # type: ignore File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/app/alembic/env.py", line 81, in run_migrations_online() File "/app/alembic/env.py", line 75, in run_migrations_online context.run_migrations() File "", line 8, in run_migrations File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/environment.py", line 946, in run_migrations self.get_context().run_migrations(**kw) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/migration.py", line 616, in run_migrations for step in self._migrations_fn(heads, self): File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 395, in upgrade return script._upgrade_revs(revision, rev) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 446, in _upgrade_revs with self._catch_revision_errors( File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 282, in _catch_revision_errors raise util.CommandError(resolution) from re alembic.util.exc.CommandError: Can't locate revision identified by 'feecc8ffb956'

ERROR 2024-09-24T13:16:00 - Application startup failed. Exiting. ERROR 2024-09-24T13:16:00 - Application startup failed. Exiting. /etc/cont-init.d/00-banner.sh: executing `

webb64b commented 1 month ago

Reverting Back to 12.0-2 has allowed be to use mealie for now, but with any update past this I have the above issue.

alexbelgium commented 1 month ago

My understanding is because "1.12.0-2" was based on the "dev" tag, it actually was produced with a code more recent than the "latest" tag available.

Therefore, I can't push any new version as long as there is not a new Mealie version pushed (1.12.2 for example) as Mealie doesn't support rolling back to previous versions. I can't also reuse the "dev" tag as it is always overwritten (so the one used for 1.12.0-2 doesn't exist anymore) ; and now the "dev" tag is on v2.

So users are stuck in a update hell : people who were on v2 can't rollback, people who were on 1.12.0-2 can't go forward until there is a new Mealie version pushed. Alas on the addon side I don't see what I can really do... Or I would need a Mealie dev to help me

webb64b commented 1 month ago

For me using HA I was able to use a backup and only restore the Mealie add on back to a working version. In Ha under system > backup I was able to search mealie and see all the backups of just the Mealie Addon and restore it.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.