Skip to content

[BUG] - error at: https://sqlalche.me/e/20/e3q8 #5453

Open
@Djivouille

Description

@Djivouille

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

DESCRITPTION

Hello,
I try to install mealie using : https://github.com/alexbelgium/hassio-addons/tree/master/mealie
It's doesn't work... i don't know why
maybe an SQL mistake, but i found nothing about : https://sqlalche.me/e/20/e3q8
Here is le logs :

-----------------------------------------------------------
 Add-on: Mealie
 Mealie is a self hosted recipe manager and meal planner built in Vue
-----------------------------------------------------------
 Add-on version: v2.8.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 15.2
 Architecture: aarch64 / qemuarm-64
 Home Assistant Core: 2025.4.4
 Home Assistant Supervisor: 2025.05.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID: 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
ALLOW_SIGNUP='true'
DATA_DIR='/config'
PGID='1000'
PUID='1000'
certfile='fullchain.pem'
keyfile='privkey.pem'
ssl='false'
Timezone set from Etc/UTC to Europe/Paris
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory
Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f_mealie/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables
... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /addon_configs/db21ed7f_mealie/mealie.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/31-nginx.sh: executing
[18:19:59] INFO: Adapting for ingress
[18:19:59] INFO: Exporting variables
ALLOW_SIGNUP=true
DATA_DIR=/config
PGID=1000
PUID=1000
certfile=fullchain.pem
keyfile=privkey.pem
ssl=false
[18:20:01] INFO: config.yaml found in /config/config.yaml, exporting variables
Permissions adapted
[18:20:01] INFO: Starting nginx
[18:20:01] INFO: Starting app
Downloading required NLTK resource: averaged_perceptron_tagger_eng
[nltk_data] Downloading package averaged_perceptron_tagger_eng to
[nltk_data]     /root/nltk_data...
[nltk_data]   Unzipping taggers/averaged_perceptron_tagger_eng.zip.
INFO     2025-05-15T18:20:32 - Started server process [7]
INFO     2025-05-15T18:20:32 - Waiting for application startup.
INFO     2025-05-15T18:20:32 - start: database initialization
INFO     2025-05-15T18:20:32 - Database connection established.
INFO     2025-05-15T18:20:32 - Context impl SQLiteImpl.
INFO     2025-05-15T18:20:32 - Will assume non-transactional DDL.
INFO     2025-05-15T18:20:32 - Migration needed. Performing migration...
INFO     2025-05-15T18:20:32 - Context impl SQLiteImpl.
INFO     2025-05-15T18:20:32 - Will assume non-transactional DDL.
INFO     2025-05-15T18:20:32 - Running upgrade be568e39ffdf -> 1fe4bd37ccc8, add households filter to meal plans
ERROR    2025-05-15T18:20:32 - Traceback (most recent call last):
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1964, in _exec_single_context
    self.dialect.do_execute(
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 942, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: table plan_rules_to_households already exists
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/opt/mealie/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
    async with self.lifespan_context(app) as maybe_state:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
    async with original_context(app) as maybe_original_state:
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
    async with original_context(app) as maybe_original_state:
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
    async with original_context(app) as maybe_original_state:
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/mealie/app.py", line 65, in lifespan_fn
    init_db.main()
  File "/opt/mealie/lib/python3.12/site-packages/mealie/db/init_db.py", line 115, in main
    command.upgrade(alembic_cfg, "head")
  File "/opt/mealie/lib/python3.12/site-packages/alembic/command.py", line 406, in upgrade
    script.run_env()
  File "/opt/mealie/lib/python3.12/site-packages/alembic/script/base.py", line 586, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/opt/mealie/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
    module = load_module_py(module_id, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/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 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
ERROR    2025-05-15T18:20:32 - Traceback (most recent call last):
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1964, in _exec_single_context
    self.dialect.do_execute(
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 942, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: table plan_rules_to_households already exists
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/opt/mealie/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
    async with self.lifespan_context(app) as maybe_state:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
    async with original_context(app) as maybe_original_state:
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
    async with original_context(app) as maybe_original_state:
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
    async with original_context(app) as maybe_original_state:
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/mealie/app.py", line 65, in lifespan_fn
    init_db.main()
  File "/opt/mealie/lib/python3.12/site-packages/mealie/db/init_db.py", line 115, in main
    command.upgrade(alembic_cfg, "head")
  File "/opt/mealie/lib/python3.12/site-packages/alembic/command.py", line 406, in upgrade
    script.run_env()
  File "/opt/mealie/lib/python3.12/site-packages/alembic/script/base.py", line 586, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/opt/mealie/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
    module = load_module_py(module_id, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/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 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/mealie/lib/python3.12/site-packages/mealie/alembic/env.py", line 109, in <module>
    run_migrations_online()
  File "/opt/mealie/lib/python3.12/site-packages/mealie/alembic/env.py", line 103, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/opt/mealie/lib/python3.12/site-packages/alembic/runtime/environment.py", line 946, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/opt/mealie/lib/python3.12/site-packages/alembic/runtime/migration.py", line 623, in run_migrations
    step.migration_fn(**kw)
  File "/opt/mealie/lib/python3.12/site-packages/mealie/alembic/versions/2024-09-18-14.52.55_1fe4bd37ccc8_add_households_filter_to_meal_plans.py", line 23, in upgrade
    op.create_table(
  File "<string>", line 8, in create_table
  File "<string>", line 3, in create_table
  File "/opt/mealie/lib/python3.12/site-packages/alembic/operations/ops.py", line 1318, in create_table
    return operations.invoke(op)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/alembic/operations/base.py", line 442, in invoke
    return fn(self, operation)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/alembic/operations/toimpl.py", line 143, in create_table
    operations.impl.create_table(table, **kw)
  File "/opt/mealie/lib/python3.12/site-packages/alembic/ddl/impl.py", line 406, in create_table
    self._exec(schema.CreateTable(table, **kw))
  File "/opt/mealie/lib/python3.12/site-packages/alembic/ddl/impl.py", line 247, in _exec
    return conn.execute(construct, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
    return meth(
           ^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/sql/ddl.py", line 180, in _execute_on_connection
    return connection._execute_ddl(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1527, in _execute_ddl
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1843, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1983, in _exec_single_context
    self._handle_dbapi_exception(
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2352, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1964, in _exec_single_context
    self.dialect.do_execute(
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 942, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table plan_rules_to_households already exists
[SQL: 
CREATE TABLE plan_rules_to_households (
	group_plan_rule_id CHAR(32), 
	household_id CHAR(32), 
	FOREIGN KEY(group_plan_rule_id) REFERENCES group_meal_plan_rules (id), 
	FOREIGN KEY(household_id) REFERENCES households (id), 
	CONSTRAINT group_plan_rule_id_household_id_key UNIQUE (group_plan_rule_id, household_id)
)
]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
ERROR    2025-05-15T18:20:32 - Application startup failed. Exiting.
  File "/opt/mealie/lib/python3.12/site-packages/mealie/alembic/env.py", line 109, in <module>
    run_migrations_online()
  File "/opt/mealie/lib/python3.12/site-packages/mealie/alembic/env.py", line 103, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/opt/mealie/lib/python3.12/site-packages/alembic/runtime/environment.py", line 946, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/opt/mealie/lib/python3.12/site-packages/alembic/runtime/migration.py", line 623, in run_migrations
    step.migration_fn(**kw)
  File "/opt/mealie/lib/python3.12/site-packages/mealie/alembic/versions/2024-09-18-14.52.55_1fe4bd37ccc8_add_households_filter_to_meal_plans.py", line 23, in upgrade
    op.create_table(
  File "<string>", line 8, in create_table
  File "<string>", line 3, in create_table
  File "/opt/mealie/lib/python3.12/site-packages/alembic/operations/ops.py", line 1318, in create_table
    return operations.invoke(op)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/alembic/operations/base.py", line 442, in invoke
    return fn(self, operation)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/alembic/operations/toimpl.py", line 143, in create_table
    operations.impl.create_table(table, **kw)
  File "/opt/mealie/lib/python3.12/site-packages/alembic/ddl/impl.py", line 406, in create_table
    self._exec(schema.CreateTable(table, **kw))
  File "/opt/mealie/lib/python3.12/site-packages/alembic/ddl/impl.py", line 247, in _exec
    return conn.execute(construct, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
    return meth(
           ^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/sql/ddl.py", line 180, in _execute_on_connection
    return connection._execute_ddl(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1527, in _execute_ddl
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1843, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1983, in _exec_single_context
    self._handle_dbapi_exception(
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2352, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1964, in _exec_single_context
    self.dialect.do_execute(
  File "/opt/mealie/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 942, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table plan_rules_to_households already exists
[SQL: 
CREATE TABLE plan_rules_to_households (
	group_plan_rule_id CHAR(32), 
	household_id CHAR(32), 
	FOREIGN KEY(group_plan_rule_id) REFERENCES group_meal_plan_rules (id), 
	FOREIGN KEY(household_id) REFERENCES households (id), 
	CONSTRAINT group_plan_rule_id_household_id_key UNIQUE (group_plan_rule_id, household_id)
)
]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
ERROR    2025-05-15T18:20:32 - Application startup failed. Exiting.

Do you have any idea to fix this ?
Thank you for your job !

Reproduction steps

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Addon Logs

Start the addon. Wait a while and check the log for any errors.

Architecture

aarch64

OS

HAos

Steps to Reproduce

.

Please provide relevant logs

..

Mealie Version

No response

Deployment

Other (please specify below)

Additional Deployment Details

https://github.com/alexbelgium/hassio-addons/tree/master/mealie

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions