Can not setting up admin account #20471

Closed
opened 2026-02-21 20:07:35 -05:00 by yindo · 5 comments
Owner

Originally created by @vergilyoungdante on GitHub (Nov 21, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

When I set up admin account, I get an internal server error.

✔️ Expected Behavior

finish set up admin account

Actual Behavior

An internal error occur.
### The dify-api error log:

2025-11-21 07:11:41.505 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/setup [POST]
2025-11-21T07:11:41.510431669Z Traceback (most recent call last):
2025-11-21T07:11:41.510434334Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2025-11-21T07:11:41.510436739Z     self.dialect.do_execute(
2025-11-21T07:11:41.510438652Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
2025-11-21T07:11:41.510440726Z     cursor.execute(statement, parameters)
2025-11-21T07:11:41.510442860Z psycopg2.errors.UndefinedTable: relation "tenant_plugin_auto_upgrade_strategies" does not exist
2025-11-21T07:11:41.510445325Z LINE 1: INSERT INTO tenant_plugin_auto_upgrade_strategies (tenant_id...
2025-11-21T07:11:41.510447669Z                     ^
2025-11-21T07:11:41.510449703Z 
2025-11-21T07:11:41.510451556Z 
2025-11-21T07:11:41.510453410Z The above exception was the direct cause of the following exception:
2025-11-21T07:11:41.510455604Z 
2025-11-21T07:11:41.510496108Z Traceback (most recent call last):
2025-11-21T07:11:41.510532365Z   File "/app/api/services/account_service.py", line 1283, in setup
2025-11-21T07:11:41.510562231Z     TenantService.create_owner_tenant_if_not_exist(account=account, is_setup=True)
2025-11-21T07:11:41.510575826Z   File "/app/api/services/account_service.py", line 1028, in create_owner_tenant_if_not_exist
2025-11-21T07:11:41.510586245Z     tenant = TenantService.create_tenant(name=f"{account.name}'s Workspace", is_setup=is_setup)
2025-11-21T07:11:41.510603176Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.510627000Z   File "/app/api/services/account_service.py", line 998, in create_tenant
2025-11-21T07:11:41.510655042Z     db.session.commit()
2025-11-21T07:11:41.510676391Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/scoping.py", line 597, in commit
2025-11-21T07:11:41.510716135Z     return self._proxied.commit()
2025-11-21T07:11:41.510745549Z            ^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.510764985Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2030, in commit
2025-11-21T07:11:41.510777448Z     trans.commit(_to_root=True)
2025-11-21T07:11:41.510815168Z   File "<string>", line 2, in commit
2025-11-21T07:11:41.510832820Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go
2025-11-21T07:11:41.510847277Z     ret_value = fn(self, *arg, **kw)
2025-11-21T07:11:41.510864639Z                 ^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.510876120Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1311, in commit
2025-11-21T07:11:41.510885688Z     self._prepare_impl()
2025-11-21T07:11:41.510895807Z   File "<string>", line 2, in _prepare_impl
2025-11-21T07:11:41.510926073Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go
2025-11-21T07:11:41.510944567Z     ret_value = fn(self, *arg, **kw)
2025-11-21T07:11:41.510961488Z                 ^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.510977117Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1286, in _prepare_impl
2025-11-21T07:11:41.511007163Z     self.session.flush()
2025-11-21T07:11:41.511025176Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4331, in flush
2025-11-21T07:11:41.511040013Z     self._flush(objects)
2025-11-21T07:11:41.511058117Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4466, in _flush
2025-11-21T07:11:41.511076210Z     with util.safe_reraise():
2025-11-21T07:11:41.511094454Z          ^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.511112748Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 224, in __exit__
2025-11-21T07:11:41.511133807Z     raise exc_value.with_traceback(exc_tb)
2025-11-21T07:11:41.511154024Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4427, in _flush
2025-11-21T07:11:41.511165094Z     flush_context.execute()
2025-11-21T07:11:41.511180954Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
2025-11-21T07:11:41.511199348Z     rec.execute(self)
2025-11-21T07:11:41.511216640Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
2025-11-21T07:11:41.511231377Z     util.preloaded.orm_persistence.save_obj(
2025-11-21T07:11:41.511246635Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
2025-11-21T07:11:41.511264749Z     _emit_insert_statements(
2025-11-21T07:11:41.511280247Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 1233, in _emit_insert_statements
2025-11-21T07:11:41.511293311Z     result = connection.execute(
2025-11-21T07:11:41.511310162Z              ^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.511326903Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
2025-11-21T07:11:41.511342362Z     return meth(
2025-11-21T07:11:41.511359003Z            ^^^^^
2025-11-21T07:11:41.511371886Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
2025-11-21T07:11:41.511388477Z     return connection._execute_clauseelement(
2025-11-21T07:11:41.511405549Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.511419905Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
2025-11-21T07:11:41.511437367Z     ret = self._execute_context(
2025-11-21T07:11:41.511462123Z           ^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.511473414Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2025-11-21T07:11:41.511483042Z     return self._exec_single_context(
2025-11-21T07:11:41.511506285Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:41.511524989Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
2025-11-21T07:11:41.511538084Z     self._handle_dbapi_exception(
2025-11-21T07:11:41.511557249Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
2025-11-21T07:11:41.511574591Z     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2025-11-21T07:11:41.511591853Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2025-11-21T07:11:41.511608704Z     self.dialect.do_execute(
2025-11-21T07:11:41.511618522Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
2025-11-21T07:11:41.511634862Z     cursor.execute(statement, parameters)
2025-11-21T07:11:41.511649049Z sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "tenant_plugin_auto_upgrade_strategies" does not exist
2025-11-21T07:11:41.511658967Z LINE 1: INSERT INTO tenant_plugin_auto_upgrade_strategies (tenant_id...`

### **The dify-worker error log:**
`025-11-21 07:11:39.604 ERROR [Dummy-2] [trace.py:267] - Task schedule.workflow_schedule_task.poll_workflow_schedules[8ff66212-e195-475d-b44f-bd903b20db30] raised unexpected: ProgrammingError('(psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist\nLINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...\n             ^\n')
2025-11-21T07:11:39.605500507Z Traceback (most recent call last):
2025-11-21T07:11:39.605503052Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2025-11-21T07:11:39.605505226Z     self.dialect.do_execute(
2025-11-21T07:11:39.605507179Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
2025-11-21T07:11:39.605509263Z     cursor.execute(statement, parameters)
2025-11-21T07:11:39.605511117Z psycopg2.errors.UndefinedTable: relation "workflow_schedule_plans" does not exist
2025-11-21T07:11:39.605512920Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...
2025-11-21T07:11:39.605514814Z              ^
2025-11-21T07:11:39.605516487Z 
2025-11-21T07:11:39.605518180Z 
2025-11-21T07:11:39.605519853Z The above exception was the direct cause of the following exception:
2025-11-21T07:11:39.605521586Z 
2025-11-21T07:11:39.605523219Z Traceback (most recent call last):
2025-11-21T07:11:39.605525694Z   File "/app/api/.venv/lib/python3.12/site-packages/celery/app/trace.py", line 453, in trace_task
2025-11-21T07:11:39.605527737Z     R = retval = fun(*args, **kwargs)
2025-11-21T07:11:39.605529691Z                  ^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605531474Z   File "/app/api/extensions/ext_celery.py", line 51, in __call__
2025-11-21T07:11:39.605533278Z     return self.run(*args, **kwargs)
2025-11-21T07:11:39.605535031Z            ^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605536674Z   File "/app/api/schedule/workflow_schedule_task.py", line 36, in poll_workflow_schedules
2025-11-21T07:11:39.605538457Z     due_schedules = _fetch_due_schedules(session)
2025-11-21T07:11:39.605540100Z                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605541843Z   File "/app/api/schedule/workflow_schedule_task.py", line 71, in _fetch_due_schedules
2025-11-21T07:11:39.605543597Z     due_schedules = session.scalars(
2025-11-21T07:11:39.605545210Z                     ^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605546853Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2459, in scalars
2025-11-21T07:11:39.605548646Z     return self._execute_internal(
2025-11-21T07:11:39.605550249Z            ^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605552623Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2249, in _execute_internal
2025-11-21T07:11:39.605554437Z     result: Result[Any] = compile_state_cls.orm_execute_statement(
2025-11-21T07:11:39.605557001Z                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605558925Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 306, in orm_execute_statement
2025-11-21T07:11:39.605570907Z     result = conn.execute(
2025-11-21T07:11:39.605573532Z              ^^^^^^^^^^^^^
2025-11-21T07:11:39.605575355Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
2025-11-21T07:11:39.605577179Z     return meth(
2025-11-21T07:11:39.605578912Z            ^^^^^
2025-11-21T07:11:39.605580695Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
2025-11-21T07:11:39.605582699Z     return connection._execute_clauseelement(
2025-11-21T07:11:39.605584612Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605586215Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
2025-11-21T07:11:39.605587979Z     ret = self._execute_context(
2025-11-21T07:11:39.605589672Z           ^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605591325Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2025-11-21T07:11:39.605593178Z     return self._exec_single_context(
2025-11-21T07:11:39.605594922Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:11:39.605596585Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
2025-11-21T07:11:39.605598388Z     self._handle_dbapi_exception(
2025-11-21T07:11:39.605600121Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
2025-11-21T07:11:39.605601965Z     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2025-11-21T07:11:39.605603638Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2025-11-21T07:11:39.605605441Z     self.dialect.do_execute(
2025-11-21T07:11:39.605607164Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
2025-11-21T07:11:39.605608977Z     cursor.execute(statement, parameters)
2025-11-21T07:11:39.605610651Z sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist
2025-11-21T07:11:39.605612504Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...
2025-11-21T07:11:39.605614247Z              ^
2025-11-21T07:11:39.605615870Z 
2025-11-21T07:11:39.605618054Z [SQL: SELECT workflow_schedule_plans.id, workflow_schedule_plans.app_id, workflow_schedule_plans.node_id, workflow_schedule_plans.tenant_id, workflow_schedule_plans.cron_expression, workflow_schedule_plans.timezone, workflow_schedule_plans.next_run_at, workflow_schedule_plans.created_at, workflow_schedule_plans.updated_at 
2025-11-21T07:11:39.605620419Z FROM workflow_schedule_plans JOIN app_triggers ON app_triggers.app_id = workflow_schedule_plans.app_id AND app_triggers.node_id = workflow_schedule_plans.node_id AND app_triggers.trigger_type = %(trigger_type_1)s 
2025-11-21T07:11:39.605625298Z WHERE workflow_schedule_plans.next_run_at <= %(next_run_at_1)s AND workflow_schedule_plans.next_run_at IS NOT NULL AND app_triggers.status = %(status_1)s ORDER BY workflow_schedule_plans.next_run_at ASC 
2025-11-21T07:11:39.605627522Z  LIMIT %(param_1)s FOR UPDATE SKIP LOCKED]
2025-11-21T07:11:39.605629265Z [parameters: {'trigger_type_1': 'trigger-schedule', 'next_run_at_1': datetime.datetime(2025, 11, 21, 7, 11, 39, 538545), 'status_1': 'enabled', 'param_1': 100}]
2025-11-21T07:11:39.605631138Z (Background on this error at: https://sqlalche.me/e/20/f405)
2025-11-21T07:12:39.537954029Z 2025-11-21 07:12:39.537 INFO [MainThread] [strategy.py:161] - Task schedule.workflow_schedule_task.poll_workflow_schedules[92cb0ec3-0d7b-46bc-9baa-a3aebf2ca48c] received
2025-11-21T07:12:39.554572761Z 2025-11-21 07:12:39.553 ERROR [Dummy-3] [trace.py:267] - Task schedule.workflow_schedule_task.poll_workflow_schedules[92cb0ec3-0d7b-46bc-9baa-a3aebf2ca48c] raised unexpected: ProgrammingError('(psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist\nLINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...\n             ^\n')
2025-11-21T07:12:39.554591185Z Traceback (most recent call last):
2025-11-21T07:12:39.554594752Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2025-11-21T07:12:39.554597957Z     self.dialect.do_execute(
2025-11-21T07:12:39.554601043Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
2025-11-21T07:12:39.554604840Z     cursor.execute(statement, parameters)
2025-11-21T07:12:39.554608076Z psycopg2.errors.UndefinedTable: relation "workflow_schedule_plans" does not exist
2025-11-21T07:12:39.554611222Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...
2025-11-21T07:12:39.554613877Z              ^
2025-11-21T07:12:39.554616492Z 
2025-11-21T07:12:39.554619097Z 
2025-11-21T07:12:39.554621591Z The above exception was the direct cause of the following exception:
2025-11-21T07:12:39.554624246Z 
2025-11-21T07:12:39.554626781Z Traceback (most recent call last):
2025-11-21T07:12:39.554629496Z   File "/app/api/.venv/lib/python3.12/site-packages/celery/app/trace.py", line 453, in trace_task
2025-11-21T07:12:39.554632341Z     R = retval = fun(*args, **kwargs)
2025-11-21T07:12:39.554634906Z                  ^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554637521Z   File "/app/api/extensions/ext_celery.py", line 51, in __call__
2025-11-21T07:12:39.554640196Z     return self.run(*args, **kwargs)
2025-11-21T07:12:39.554642760Z            ^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554645385Z   File "/app/api/schedule/workflow_schedule_task.py", line 36, in poll_workflow_schedules
2025-11-21T07:12:39.554648050Z     due_schedules = _fetch_due_schedules(session)
2025-11-21T07:12:39.554657848Z                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554659692Z   File "/app/api/schedule/workflow_schedule_task.py", line 71, in _fetch_due_schedules
2025-11-21T07:12:39.554661475Z     due_schedules = session.scalars(
2025-11-21T07:12:39.554663188Z                     ^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554664881Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2459, in scalars
2025-11-21T07:12:39.554666705Z     return self._execute_internal(
2025-11-21T07:12:39.554668418Z            ^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554670071Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2249, in _execute_internal
2025-11-21T07:12:39.554671884Z     result: Result[Any] = compile_state_cls.orm_execute_statement(
2025-11-21T07:12:39.554674409Z                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554676272Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 306, in orm_execute_statement
2025-11-21T07:12:39.554678136Z     result = conn.execute(
2025-11-21T07:12:39.554679799Z              ^^^^^^^^^^^^^
2025-11-21T07:12:39.554681492Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
2025-11-21T07:12:39.554683275Z     return meth(
2025-11-21T07:12:39.554685269Z            ^^^^^
2025-11-21T07:12:39.554686972Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
2025-11-21T07:12:39.554688835Z     return connection._execute_clauseelement(
2025-11-21T07:12:39.554690519Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554692212Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
2025-11-21T07:12:39.554694075Z     ret = self._execute_context(
2025-11-21T07:12:39.554695758Z           ^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554697421Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2025-11-21T07:12:39.554699205Z     return self._exec_single_context(
2025-11-21T07:12:39.554700858Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-21T07:12:39.554702511Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
2025-11-21T07:12:39.554704344Z     self._handle_dbapi_exception(
2025-11-21T07:12:39.554706007Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
2025-11-21T07:12:39.554707820Z     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2025-11-21T07:12:39.554709574Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2025-11-21T07:12:39.554714703Z     self.dialect.do_execute(
2025-11-21T07:12:39.554716486Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
2025-11-21T07:12:39.554718380Z     cursor.execute(statement, parameters)
2025-11-21T07:12:39.554720093Z sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist
2025-11-21T07:12:39.554721947Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...
2025-11-21T07:12:39.554723690Z              ^
2025-11-21T07:12:39.554725333Z 
2025-11-21T07:12:39.554727056Z [SQL: SELECT workflow_schedule_plans.id, workflow_schedule_plans.app_id, workflow_schedule_plans.node_id, workflow_schedule_plans.tenant_id, workflow_schedule_plans.cron_expression, workflow_schedule_plans.timezone, workflow_schedule_plans.next_run_at, workflow_schedule_plans.created_at, workflow_schedule_plans.updated_at 
2025-11-21T07:12:39.554729430Z FROM workflow_schedule_plans JOIN app_triggers ON app_triggers.app_id = workflow_schedule_plans.app_id AND app_triggers.node_id = workflow_schedule_plans.node_id AND app_triggers.trigger_type = %(trigger_type_1)s 
2025-11-21T07:12:39.554731414Z WHERE workflow_schedule_plans.next_run_at <= %(next_run_at_1)s AND workflow_schedule_plans.next_run_at IS NOT NULL AND app_triggers.status = %(status_1)s ORDER BY workflow_schedule_plans.next_run_at ASC 
2025-11-21T07:12:39.554733518Z  LIMIT %(param_1)s FOR UPDATE SKIP LOCKED]
2025-11-21T07:12:39.554735211Z [parameters: {'trigger_type_1': 'trigger-schedule', 'next_run_at_1': datetime.datetime(2025, 11, 21, 7, 12, 39, 538337), 'status_1': 'enabled', 'param_1': 100}]
2025-11-21T07:12:39.554737085Z (Background on this error at: https://sqlalche.me/e/20/f405)
2025-11-21T07:13:39.538088901Z 2025-11-21 07:13:39.537 INFO [MainThread] [strategy.py:161] - Task schedule.workflow_schedule_task.poll_workflow_schedules[eb7bf057-b305-4882-a7e0-28183f8de225] received
2025-11-21T07:13:39.554856218Z 2025-11-21 07:13:39.554 ERROR [Dummy-4] [trace.py:267] - Task schedule.workflow_schedule_task.poll_workflow_schedules[eb7bf057-b305-4882-a7e0-28183f8de225] raised unexpected: ProgrammingError('(psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist\nLINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...\n             ^\n')
2025-11-21T07:13:39.554875043Z Traceback (most recent call last):
2025-11-21T07:13:39.554878660Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2025-11-21T07:13:39.554882116Z     self.dialect.do_execute(
2025-11-21T07:13:39.554885072Z   File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
2025-11-21T07:13:39.554888568Z     cursor.execute(statement, parameters)
2025-11-21T07:13:39.554891724Z psycopg2.errors.UndefinedTable: relation "workflow_schedule_plans" does not exist
2025-11-21T07:13:39.554895481Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...
Originally created by @vergilyoungdante on GitHub (Nov 21, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.10.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="3072" height="1582" alt="Image" src="https://github.com/user-attachments/assets/439007c0-a416-4d5c-985a-7b0a70e90009" /> When I set up admin account, I get an internal server error. ### ✔️ Expected Behavior finish set up admin account ### ❌ Actual Behavior An internal error occur. **### The dify-api error log:** ``` 2025-11-21 07:11:41.505 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/setup [POST] 2025-11-21T07:11:41.510431669Z Traceback (most recent call last): 2025-11-21T07:11:41.510434334Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-11-21T07:11:41.510436739Z self.dialect.do_execute( 2025-11-21T07:11:41.510438652Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute 2025-11-21T07:11:41.510440726Z cursor.execute(statement, parameters) 2025-11-21T07:11:41.510442860Z psycopg2.errors.UndefinedTable: relation "tenant_plugin_auto_upgrade_strategies" does not exist 2025-11-21T07:11:41.510445325Z LINE 1: INSERT INTO tenant_plugin_auto_upgrade_strategies (tenant_id... 2025-11-21T07:11:41.510447669Z ^ 2025-11-21T07:11:41.510449703Z 2025-11-21T07:11:41.510451556Z 2025-11-21T07:11:41.510453410Z The above exception was the direct cause of the following exception: 2025-11-21T07:11:41.510455604Z 2025-11-21T07:11:41.510496108Z Traceback (most recent call last): 2025-11-21T07:11:41.510532365Z File "/app/api/services/account_service.py", line 1283, in setup 2025-11-21T07:11:41.510562231Z TenantService.create_owner_tenant_if_not_exist(account=account, is_setup=True) 2025-11-21T07:11:41.510575826Z File "/app/api/services/account_service.py", line 1028, in create_owner_tenant_if_not_exist 2025-11-21T07:11:41.510586245Z tenant = TenantService.create_tenant(name=f"{account.name}'s Workspace", is_setup=is_setup) 2025-11-21T07:11:41.510603176Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.510627000Z File "/app/api/services/account_service.py", line 998, in create_tenant 2025-11-21T07:11:41.510655042Z db.session.commit() 2025-11-21T07:11:41.510676391Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/scoping.py", line 597, in commit 2025-11-21T07:11:41.510716135Z return self._proxied.commit() 2025-11-21T07:11:41.510745549Z ^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.510764985Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2030, in commit 2025-11-21T07:11:41.510777448Z trans.commit(_to_root=True) 2025-11-21T07:11:41.510815168Z File "<string>", line 2, in commit 2025-11-21T07:11:41.510832820Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go 2025-11-21T07:11:41.510847277Z ret_value = fn(self, *arg, **kw) 2025-11-21T07:11:41.510864639Z ^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.510876120Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1311, in commit 2025-11-21T07:11:41.510885688Z self._prepare_impl() 2025-11-21T07:11:41.510895807Z File "<string>", line 2, in _prepare_impl 2025-11-21T07:11:41.510926073Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go 2025-11-21T07:11:41.510944567Z ret_value = fn(self, *arg, **kw) 2025-11-21T07:11:41.510961488Z ^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.510977117Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1286, in _prepare_impl 2025-11-21T07:11:41.511007163Z self.session.flush() 2025-11-21T07:11:41.511025176Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4331, in flush 2025-11-21T07:11:41.511040013Z self._flush(objects) 2025-11-21T07:11:41.511058117Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4466, in _flush 2025-11-21T07:11:41.511076210Z with util.safe_reraise(): 2025-11-21T07:11:41.511094454Z ^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.511112748Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 224, in __exit__ 2025-11-21T07:11:41.511133807Z raise exc_value.with_traceback(exc_tb) 2025-11-21T07:11:41.511154024Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 4427, in _flush 2025-11-21T07:11:41.511165094Z flush_context.execute() 2025-11-21T07:11:41.511180954Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute 2025-11-21T07:11:41.511199348Z rec.execute(self) 2025-11-21T07:11:41.511216640Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute 2025-11-21T07:11:41.511231377Z util.preloaded.orm_persistence.save_obj( 2025-11-21T07:11:41.511246635Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj 2025-11-21T07:11:41.511264749Z _emit_insert_statements( 2025-11-21T07:11:41.511280247Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/persistence.py", line 1233, in _emit_insert_statements 2025-11-21T07:11:41.511293311Z result = connection.execute( 2025-11-21T07:11:41.511310162Z ^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.511326903Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute 2025-11-21T07:11:41.511342362Z return meth( 2025-11-21T07:11:41.511359003Z ^^^^^ 2025-11-21T07:11:41.511371886Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection 2025-11-21T07:11:41.511388477Z return connection._execute_clauseelement( 2025-11-21T07:11:41.511405549Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.511419905Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement 2025-11-21T07:11:41.511437367Z ret = self._execute_context( 2025-11-21T07:11:41.511462123Z ^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.511473414Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context 2025-11-21T07:11:41.511483042Z return self._exec_single_context( 2025-11-21T07:11:41.511506285Z ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:41.511524989Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context 2025-11-21T07:11:41.511538084Z self._handle_dbapi_exception( 2025-11-21T07:11:41.511557249Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception 2025-11-21T07:11:41.511574591Z raise sqlalchemy_exception.with_traceback(exc_info[2]) from e 2025-11-21T07:11:41.511591853Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-11-21T07:11:41.511608704Z self.dialect.do_execute( 2025-11-21T07:11:41.511618522Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute 2025-11-21T07:11:41.511634862Z cursor.execute(statement, parameters) 2025-11-21T07:11:41.511649049Z sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "tenant_plugin_auto_upgrade_strategies" does not exist 2025-11-21T07:11:41.511658967Z LINE 1: INSERT INTO tenant_plugin_auto_upgrade_strategies (tenant_id...` ### **The dify-worker error log:** `025-11-21 07:11:39.604 ERROR [Dummy-2] [trace.py:267] - Task schedule.workflow_schedule_task.poll_workflow_schedules[8ff66212-e195-475d-b44f-bd903b20db30] raised unexpected: ProgrammingError('(psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist\nLINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...\n ^\n') 2025-11-21T07:11:39.605500507Z Traceback (most recent call last): 2025-11-21T07:11:39.605503052Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-11-21T07:11:39.605505226Z self.dialect.do_execute( 2025-11-21T07:11:39.605507179Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute 2025-11-21T07:11:39.605509263Z cursor.execute(statement, parameters) 2025-11-21T07:11:39.605511117Z psycopg2.errors.UndefinedTable: relation "workflow_schedule_plans" does not exist 2025-11-21T07:11:39.605512920Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge... 2025-11-21T07:11:39.605514814Z ^ 2025-11-21T07:11:39.605516487Z 2025-11-21T07:11:39.605518180Z 2025-11-21T07:11:39.605519853Z The above exception was the direct cause of the following exception: 2025-11-21T07:11:39.605521586Z 2025-11-21T07:11:39.605523219Z Traceback (most recent call last): 2025-11-21T07:11:39.605525694Z File "/app/api/.venv/lib/python3.12/site-packages/celery/app/trace.py", line 453, in trace_task 2025-11-21T07:11:39.605527737Z R = retval = fun(*args, **kwargs) 2025-11-21T07:11:39.605529691Z ^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605531474Z File "/app/api/extensions/ext_celery.py", line 51, in __call__ 2025-11-21T07:11:39.605533278Z return self.run(*args, **kwargs) 2025-11-21T07:11:39.605535031Z ^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605536674Z File "/app/api/schedule/workflow_schedule_task.py", line 36, in poll_workflow_schedules 2025-11-21T07:11:39.605538457Z due_schedules = _fetch_due_schedules(session) 2025-11-21T07:11:39.605540100Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605541843Z File "/app/api/schedule/workflow_schedule_task.py", line 71, in _fetch_due_schedules 2025-11-21T07:11:39.605543597Z due_schedules = session.scalars( 2025-11-21T07:11:39.605545210Z ^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605546853Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2459, in scalars 2025-11-21T07:11:39.605548646Z return self._execute_internal( 2025-11-21T07:11:39.605550249Z ^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605552623Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2249, in _execute_internal 2025-11-21T07:11:39.605554437Z result: Result[Any] = compile_state_cls.orm_execute_statement( 2025-11-21T07:11:39.605557001Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605558925Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 306, in orm_execute_statement 2025-11-21T07:11:39.605570907Z result = conn.execute( 2025-11-21T07:11:39.605573532Z ^^^^^^^^^^^^^ 2025-11-21T07:11:39.605575355Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute 2025-11-21T07:11:39.605577179Z return meth( 2025-11-21T07:11:39.605578912Z ^^^^^ 2025-11-21T07:11:39.605580695Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection 2025-11-21T07:11:39.605582699Z return connection._execute_clauseelement( 2025-11-21T07:11:39.605584612Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605586215Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement 2025-11-21T07:11:39.605587979Z ret = self._execute_context( 2025-11-21T07:11:39.605589672Z ^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605591325Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context 2025-11-21T07:11:39.605593178Z return self._exec_single_context( 2025-11-21T07:11:39.605594922Z ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:11:39.605596585Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context 2025-11-21T07:11:39.605598388Z self._handle_dbapi_exception( 2025-11-21T07:11:39.605600121Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception 2025-11-21T07:11:39.605601965Z raise sqlalchemy_exception.with_traceback(exc_info[2]) from e 2025-11-21T07:11:39.605603638Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-11-21T07:11:39.605605441Z self.dialect.do_execute( 2025-11-21T07:11:39.605607164Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute 2025-11-21T07:11:39.605608977Z cursor.execute(statement, parameters) 2025-11-21T07:11:39.605610651Z sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist 2025-11-21T07:11:39.605612504Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge... 2025-11-21T07:11:39.605614247Z ^ 2025-11-21T07:11:39.605615870Z 2025-11-21T07:11:39.605618054Z [SQL: SELECT workflow_schedule_plans.id, workflow_schedule_plans.app_id, workflow_schedule_plans.node_id, workflow_schedule_plans.tenant_id, workflow_schedule_plans.cron_expression, workflow_schedule_plans.timezone, workflow_schedule_plans.next_run_at, workflow_schedule_plans.created_at, workflow_schedule_plans.updated_at 2025-11-21T07:11:39.605620419Z FROM workflow_schedule_plans JOIN app_triggers ON app_triggers.app_id = workflow_schedule_plans.app_id AND app_triggers.node_id = workflow_schedule_plans.node_id AND app_triggers.trigger_type = %(trigger_type_1)s 2025-11-21T07:11:39.605625298Z WHERE workflow_schedule_plans.next_run_at <= %(next_run_at_1)s AND workflow_schedule_plans.next_run_at IS NOT NULL AND app_triggers.status = %(status_1)s ORDER BY workflow_schedule_plans.next_run_at ASC 2025-11-21T07:11:39.605627522Z LIMIT %(param_1)s FOR UPDATE SKIP LOCKED] 2025-11-21T07:11:39.605629265Z [parameters: {'trigger_type_1': 'trigger-schedule', 'next_run_at_1': datetime.datetime(2025, 11, 21, 7, 11, 39, 538545), 'status_1': 'enabled', 'param_1': 100}] 2025-11-21T07:11:39.605631138Z (Background on this error at: https://sqlalche.me/e/20/f405) 2025-11-21T07:12:39.537954029Z 2025-11-21 07:12:39.537 INFO [MainThread] [strategy.py:161] - Task schedule.workflow_schedule_task.poll_workflow_schedules[92cb0ec3-0d7b-46bc-9baa-a3aebf2ca48c] received 2025-11-21T07:12:39.554572761Z 2025-11-21 07:12:39.553 ERROR [Dummy-3] [trace.py:267] - Task schedule.workflow_schedule_task.poll_workflow_schedules[92cb0ec3-0d7b-46bc-9baa-a3aebf2ca48c] raised unexpected: ProgrammingError('(psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist\nLINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...\n ^\n') 2025-11-21T07:12:39.554591185Z Traceback (most recent call last): 2025-11-21T07:12:39.554594752Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-11-21T07:12:39.554597957Z self.dialect.do_execute( 2025-11-21T07:12:39.554601043Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute 2025-11-21T07:12:39.554604840Z cursor.execute(statement, parameters) 2025-11-21T07:12:39.554608076Z psycopg2.errors.UndefinedTable: relation "workflow_schedule_plans" does not exist 2025-11-21T07:12:39.554611222Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge... 2025-11-21T07:12:39.554613877Z ^ 2025-11-21T07:12:39.554616492Z 2025-11-21T07:12:39.554619097Z 2025-11-21T07:12:39.554621591Z The above exception was the direct cause of the following exception: 2025-11-21T07:12:39.554624246Z 2025-11-21T07:12:39.554626781Z Traceback (most recent call last): 2025-11-21T07:12:39.554629496Z File "/app/api/.venv/lib/python3.12/site-packages/celery/app/trace.py", line 453, in trace_task 2025-11-21T07:12:39.554632341Z R = retval = fun(*args, **kwargs) 2025-11-21T07:12:39.554634906Z ^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554637521Z File "/app/api/extensions/ext_celery.py", line 51, in __call__ 2025-11-21T07:12:39.554640196Z return self.run(*args, **kwargs) 2025-11-21T07:12:39.554642760Z ^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554645385Z File "/app/api/schedule/workflow_schedule_task.py", line 36, in poll_workflow_schedules 2025-11-21T07:12:39.554648050Z due_schedules = _fetch_due_schedules(session) 2025-11-21T07:12:39.554657848Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554659692Z File "/app/api/schedule/workflow_schedule_task.py", line 71, in _fetch_due_schedules 2025-11-21T07:12:39.554661475Z due_schedules = session.scalars( 2025-11-21T07:12:39.554663188Z ^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554664881Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2459, in scalars 2025-11-21T07:12:39.554666705Z return self._execute_internal( 2025-11-21T07:12:39.554668418Z ^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554670071Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2249, in _execute_internal 2025-11-21T07:12:39.554671884Z result: Result[Any] = compile_state_cls.orm_execute_statement( 2025-11-21T07:12:39.554674409Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554676272Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 306, in orm_execute_statement 2025-11-21T07:12:39.554678136Z result = conn.execute( 2025-11-21T07:12:39.554679799Z ^^^^^^^^^^^^^ 2025-11-21T07:12:39.554681492Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute 2025-11-21T07:12:39.554683275Z return meth( 2025-11-21T07:12:39.554685269Z ^^^^^ 2025-11-21T07:12:39.554686972Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection 2025-11-21T07:12:39.554688835Z return connection._execute_clauseelement( 2025-11-21T07:12:39.554690519Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554692212Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement 2025-11-21T07:12:39.554694075Z ret = self._execute_context( 2025-11-21T07:12:39.554695758Z ^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554697421Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context 2025-11-21T07:12:39.554699205Z return self._exec_single_context( 2025-11-21T07:12:39.554700858Z ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-11-21T07:12:39.554702511Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context 2025-11-21T07:12:39.554704344Z self._handle_dbapi_exception( 2025-11-21T07:12:39.554706007Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception 2025-11-21T07:12:39.554707820Z raise sqlalchemy_exception.with_traceback(exc_info[2]) from e 2025-11-21T07:12:39.554709574Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-11-21T07:12:39.554714703Z self.dialect.do_execute( 2025-11-21T07:12:39.554716486Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute 2025-11-21T07:12:39.554718380Z cursor.execute(statement, parameters) 2025-11-21T07:12:39.554720093Z sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist 2025-11-21T07:12:39.554721947Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge... 2025-11-21T07:12:39.554723690Z ^ 2025-11-21T07:12:39.554725333Z 2025-11-21T07:12:39.554727056Z [SQL: SELECT workflow_schedule_plans.id, workflow_schedule_plans.app_id, workflow_schedule_plans.node_id, workflow_schedule_plans.tenant_id, workflow_schedule_plans.cron_expression, workflow_schedule_plans.timezone, workflow_schedule_plans.next_run_at, workflow_schedule_plans.created_at, workflow_schedule_plans.updated_at 2025-11-21T07:12:39.554729430Z FROM workflow_schedule_plans JOIN app_triggers ON app_triggers.app_id = workflow_schedule_plans.app_id AND app_triggers.node_id = workflow_schedule_plans.node_id AND app_triggers.trigger_type = %(trigger_type_1)s 2025-11-21T07:12:39.554731414Z WHERE workflow_schedule_plans.next_run_at <= %(next_run_at_1)s AND workflow_schedule_plans.next_run_at IS NOT NULL AND app_triggers.status = %(status_1)s ORDER BY workflow_schedule_plans.next_run_at ASC 2025-11-21T07:12:39.554733518Z LIMIT %(param_1)s FOR UPDATE SKIP LOCKED] 2025-11-21T07:12:39.554735211Z [parameters: {'trigger_type_1': 'trigger-schedule', 'next_run_at_1': datetime.datetime(2025, 11, 21, 7, 12, 39, 538337), 'status_1': 'enabled', 'param_1': 100}] 2025-11-21T07:12:39.554737085Z (Background on this error at: https://sqlalche.me/e/20/f405) 2025-11-21T07:13:39.538088901Z 2025-11-21 07:13:39.537 INFO [MainThread] [strategy.py:161] - Task schedule.workflow_schedule_task.poll_workflow_schedules[eb7bf057-b305-4882-a7e0-28183f8de225] received 2025-11-21T07:13:39.554856218Z 2025-11-21 07:13:39.554 ERROR [Dummy-4] [trace.py:267] - Task schedule.workflow_schedule_task.poll_workflow_schedules[eb7bf057-b305-4882-a7e0-28183f8de225] raised unexpected: ProgrammingError('(psycopg2.errors.UndefinedTable) relation "workflow_schedule_plans" does not exist\nLINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge...\n ^\n') 2025-11-21T07:13:39.554875043Z Traceback (most recent call last): 2025-11-21T07:13:39.554878660Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-11-21T07:13:39.554882116Z self.dialect.do_execute( 2025-11-21T07:13:39.554885072Z File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute 2025-11-21T07:13:39.554888568Z cursor.execute(statement, parameters) 2025-11-21T07:13:39.554891724Z psycopg2.errors.UndefinedTable: relation "workflow_schedule_plans" does not exist 2025-11-21T07:13:39.554895481Z LINE 2: FROM workflow_schedule_plans JOIN app_triggers ON app_trigge... ```
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 20:07:35 -05:00
yindo closed this issue 2026-02-21 20:07:35 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 21, 2025):

The internal server error during admin account setup is caused by missing database tables (tenant_plugin_auto_upgrade_strategies and workflow_schedule_plans). This happens when database migrations have not been run or completed successfully.

To fix this, you need to run the database migrations in your Docker environment. Make sure the environment variable MIGRATION_ENABLED is set to true for your API container. The entrypoint script will then run flask upgrade-db, which applies all necessary migrations and creates the missing tables. You can also run the migration manually by executing:

docker compose exec api flask upgrade-db

Or, for pure migration mode (without starting the server):

docker compose run --rm -e MODE=migration api

After the migrations complete, retry the admin setup. This should resolve the internal server error and allow you to finish setting up your admin account.

References:

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 21, 2025): <!-- Answer --> The internal server error during admin account setup is caused by missing database tables (`tenant_plugin_auto_upgrade_strategies` and `workflow_schedule_plans`). This happens when database migrations have not been run or completed successfully. To fix this, you need to run the database migrations in your Docker environment. Make sure the environment variable `MIGRATION_ENABLED` is set to `true` for your API container. The entrypoint script will then run `flask upgrade-db`, which applies all necessary migrations and creates the missing tables. You can also run the migration manually by executing: ```bash docker compose exec api flask upgrade-db ``` Or, for pure migration mode (without starting the server): ```bash docker compose run --rm -e MODE=migration api ``` After the migrations complete, retry the admin setup. This should resolve the internal server error and allow you to finish setting up your admin account. References: - [Docker entrypoint migration logic](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/docker/entrypoint.sh#L10-L18) - [Migration command details](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/commands.py#L696-L717) - [Migration scripts for missing tables](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/migrations/versions/2025_07_23_1508-8bcc02c9bd07_add_tenant_plugin_autoupgrade_table.py#L14-L63) - [Migration scripts for workflow_schedule_plans](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/migrations/versions/2025_10_30_1518-669ffd70119c_introduce_trigger.py#L1-L381) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28497)
Author
Owner

@vergilyoungdante commented on GitHub (Nov 21, 2025):

The internal server error during admin account setup is caused by missing database tables (tenant_plugin_auto_upgrade_strategies and workflow_schedule_plans). This happens when database migrations have not been run or completed successfully.

To fix this, you need to run the database migrations in your Docker environment. Make sure the environment variable MIGRATION_ENABLED is set to true for your API container. The entrypoint script will then run flask upgrade-db, which applies all necessary migrations and creates the missing tables. You can also run the migration manually by executing:

docker compose exec api flask upgrade-db
Or, for pure migration mode (without starting the server):

docker compose run --rm -e MODE=migration api
After the migrations complete, retry the admin setup. This should resolve the internal server error and allow you to finish setting up your admin account.

References:

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

Image I run flask upgrade-db command, but it is still not work when I set up admin account.
@vergilyoungdante commented on GitHub (Nov 21, 2025): > The internal server error during admin account setup is caused by missing database tables (`tenant_plugin_auto_upgrade_strategies` and `workflow_schedule_plans`). This happens when database migrations have not been run or completed successfully. > > To fix this, you need to run the database migrations in your Docker environment. Make sure the environment variable `MIGRATION_ENABLED` is set to `true` for your API container. The entrypoint script will then run `flask upgrade-db`, which applies all necessary migrations and creates the missing tables. You can also run the migration manually by executing: > > docker compose exec api flask upgrade-db > Or, for pure migration mode (without starting the server): > > docker compose run --rm -e MODE=migration api > After the migrations complete, retry the admin setup. This should resolve the internal server error and allow you to finish setting up your admin account. > > References: > > * [Docker entrypoint migration logic](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/docker/entrypoint.sh#L10-L18) > * [Migration command details](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/commands.py#L696-L717) > * [Migration scripts for missing tables](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/migrations/versions/2025_07_23_1508-8bcc02c9bd07_add_tenant_plugin_autoupgrade_table.py#L14-L63) > * [Migration scripts for workflow_schedule_plans](https://github.com/langgenius/dify/blob/4486b54680bb3b59ca2414aadc3670acb5a5c4be/api/migrations/versions/2025_10_30_1518-669ffd70119c_introduce_trigger.py#L1-L381) > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/71ff9d0e-c8b7-45a7-b0a5-c899f6f3b57e?feedback_type=other)  [![Chat with Dosu](https://camo.githubusercontent.com/7c571478962a6b8a5d47cac74b6824c75e4f6731bba52377e6007f9150462923/68747470733a2f2f646f73752e6465762f646f73752d636861742d62616467652e737667)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github) [![Join Discord](https://camo.githubusercontent.com/7d2066700925db1e370d956834f9ea0e5bc92cecbe84963fbd2a363e45091b4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/a8bd7f3fcf3f5e3bd124eee9ae50ae2ac17b40971726665ac2121d48f9aee155/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28497) <img width="2330" height="876" alt="Image" src="https://github.com/user-attachments/assets/41bef171-de4b-4059-b5db-cdcc11af781b" /> I run flask upgrade-db command, but it is still not work when I set up admin account.
Author
Owner

@dosubot[bot] commented on GitHub (Nov 21, 2025):

It looks like the migrations that create the missing tables may not have actually run, even though you executed flask upgrade-db. This can happen if the migration history is out of sync or if the migrations were "stamped" as applied without running their code.

Here’s what to check and try next:

  1. Check which migrations are applied:
    Connect to your database and run:

    SELECT * FROM alembic_version;
    

    Compare the result to the latest migration filenames in api/migrations/versions/. The migrations that create the missing tables are:

    • 2025_07_23_1508-8bcc02c9bd07_add_tenant_plugin_autoupgrade_table.py
    • 2025_10_30_1518-669ffd70119c_introduce_trigger.py
  2. If the alembic_version is ahead of these migrations, but the tables are missing:
    It’s likely the migration was stamped but not run. To fix:

    • Find the down_revision for the missing migration (for 8bcc02c9bd07, it’s 375fe79ead14).
    • Run:
      docker compose exec api flask db stamp 375fe79ead14
      docker compose exec api flask upgrade-db
      

    This will force Alembic to actually run the migration and create the table. Repeat for any other missing migrations as needed.

  3. Verify your database connection:
    Make sure the database your containers are using is the same one you’re inspecting. In your database client, run \conninfo (Postgres) and compare with your .env or Docker Compose settings (DB_HOST, DB_PORT, DB_DATABASE).

  4. Restart your containers after migration:
    Sometimes the app needs a restart to pick up schema changes:

    docker compose restart
    
  5. Check for errors in migration logs:
    If you see any errors or warnings when running flask upgrade-db, share the full output here.

If you follow these steps, you should be able to resolve the missing tables and complete the admin setup. For more details and troubleshooting, see this discussion.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 21, 2025): <!-- Answer --> It looks like the migrations that create the missing tables may not have actually run, even though you executed `flask upgrade-db`. This can happen if the migration history is out of sync or if the migrations were "stamped" as applied without running their code. Here’s what to check and try next: 1. **Check which migrations are applied:** Connect to your database and run: ```sql SELECT * FROM alembic_version; ``` Compare the result to the latest migration filenames in `api/migrations/versions/`. The migrations that create the missing tables are: - `2025_07_23_1508-8bcc02c9bd07_add_tenant_plugin_autoupgrade_table.py` - `2025_10_30_1518-669ffd70119c_introduce_trigger.py` 2. **If the alembic_version is ahead of these migrations, but the tables are missing:** It’s likely the migration was stamped but not run. To fix: - Find the `down_revision` for the missing migration (for `8bcc02c9bd07`, it’s `375fe79ead14`). - Run: ```bash docker compose exec api flask db stamp 375fe79ead14 docker compose exec api flask upgrade-db ``` This will force Alembic to actually run the migration and create the table. Repeat for any other missing migrations as needed. 3. **Verify your database connection:** Make sure the database your containers are using is the same one you’re inspecting. In your database client, run `\conninfo` (Postgres) and compare with your `.env` or Docker Compose settings (`DB_HOST`, `DB_PORT`, `DB_DATABASE`). 4. **Restart your containers after migration:** Sometimes the app needs a restart to pick up schema changes: ```bash docker compose restart ``` 5. **Check for errors in migration logs:** If you see any errors or warnings when running `flask upgrade-db`, share the full output here. If you follow these steps, you should be able to resolve the missing tables and complete the admin setup. For more details and troubleshooting, see [this discussion](https://github.com/langgenius/dify/discussions/23824#discussioncomment-14082275). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28497)
Author
Owner

@vergilyoungdante commented on GitHub (Nov 21, 2025):

It looks like the migrations that create the missing tables may not have actually run, even though you executed flask upgrade-db. This can happen if the migration history is out of sync or if the migrations were "stamped" as applied without running their code.

Here’s what to check and try next:

  1. Check which migrations are applied:
    Connect to your database and run:
    SELECT * FROM alembic_version;

    Compare the result to the latest migration filenames in api/migrations/versions/. The migrations that create the missing tables are:

    • 2025_07_23_1508-8bcc02c9bd07_add_tenant_plugin_autoupgrade_table.py
    • 2025_10_30_1518-669ffd70119c_introduce_trigger.py
  2. If the alembic_version is ahead of these migrations, but the tables are missing:
    It’s likely the migration was stamped but not run. To fix:

    • Find the down_revision for the missing migration (for 8bcc02c9bd07, it’s 375fe79ead14).
    • Run:
      docker compose exec api flask db stamp 375fe79ead14
      docker compose exec api flask upgrade-db

    This will force Alembic to actually run the migration and create the table. Repeat for any other missing migrations as needed.

  3. Verify your database connection:
    Make sure the database your containers are using is the same one you’re inspecting. In your database client, run \conninfo (Postgres) and compare with your .env or Docker Compose settings (DB_HOST, DB_PORT, DB_DATABASE).

  4. Restart your containers after migration:
    Sometimes the app needs a restart to pick up schema changes:
    docker compose restart

  5. Check for errors in migration logs:
    If you see any errors or warnings when running flask upgrade-db, share the full output here.

If you follow these steps, you should be able to resolve the missing tables and complete the admin setup. For more details and troubleshooting, see this discussion.

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

I do follow your step, but I find my alembic_version stop at 2adcbe1f5dfd, so it is mean the dify don't create table which created after 2025/05/15. So how can I create these tables.

@vergilyoungdante commented on GitHub (Nov 21, 2025): > It looks like the migrations that create the missing tables may not have actually run, even though you executed `flask upgrade-db`. This can happen if the migration history is out of sync or if the migrations were "stamped" as applied without running their code. > > Here’s what to check and try next: > > 1. **Check which migrations are applied:** > Connect to your database and run: > SELECT * FROM alembic_version; > > > > > > > > > > Compare the result to the latest migration filenames in `api/migrations/versions/`. The migrations that create the missing tables are: > > * `2025_07_23_1508-8bcc02c9bd07_add_tenant_plugin_autoupgrade_table.py` > * `2025_10_30_1518-669ffd70119c_introduce_trigger.py` > 2. **If the alembic_version is ahead of these migrations, but the tables are missing:** > It’s likely the migration was stamped but not run. To fix: > > * Find the `down_revision` for the missing migration (for `8bcc02c9bd07`, it’s `375fe79ead14`). > * Run: > docker compose exec api flask db stamp 375fe79ead14 > docker compose exec api flask upgrade-db > > This will force Alembic to actually run the migration and create the table. Repeat for any other missing migrations as needed. > 3. **Verify your database connection:** > Make sure the database your containers are using is the same one you’re inspecting. In your database client, run `\conninfo` (Postgres) and compare with your `.env` or Docker Compose settings (`DB_HOST`, `DB_PORT`, `DB_DATABASE`). > 4. **Restart your containers after migration:** > Sometimes the app needs a restart to pick up schema changes: > docker compose restart > 5. **Check for errors in migration logs:** > If you see any errors or warnings when running `flask upgrade-db`, share the full output here. > > If you follow these steps, you should be able to resolve the missing tables and complete the admin setup. For more details and troubleshooting, see [this discussion](https://github.com/langgenius/dify/discussions/23824#discussioncomment-14082275). > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0fd8e8e7-3ca2-437a-9f65-b704de3428a2?feedback_type=other)  [![Chat with Dosu](https://camo.githubusercontent.com/7c571478962a6b8a5d47cac74b6824c75e4f6731bba52377e6007f9150462923/68747470733a2f2f646f73752e6465762f646f73752d636861742d62616467652e737667)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github) [![Join Discord](https://camo.githubusercontent.com/7d2066700925db1e370d956834f9ea0e5bc92cecbe84963fbd2a363e45091b4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/a8bd7f3fcf3f5e3bd124eee9ae50ae2ac17b40971726665ac2121d48f9aee155/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28497) I do follow your step, but I find my alembic_version stop at 2adcbe1f5dfd, so it is mean the dify don't create table which created after 2025/05/15. So how can I create these tables.
Author
Owner

@crazywoola commented on GitHub (Nov 23, 2025):

Go to the api container run uv run flask db upgrade

@crazywoola commented on GitHub (Nov 23, 2025): Go to the api container run `uv run flask db upgrade`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20471