The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. #5336

Closed
opened 2026-02-21 18:10:28 -05:00 by yindo · 3 comments
Owner

Originally created by @Sure0520 on GitHub (Sep 1, 2024).

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.7.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

2024-09-02 02:37:27,095.095 ERROR [Dummy-27] [workflow.py:190] - internal server error.
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation "workflow__conversation_variables" does not exist
LINE 2: FROM workflow__conversation_variables
             ^


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

Traceback (most recent call last):
  File "/app/api/controllers/console/app/workflow.py", line 174, in post
    response = AppGenerateService.generate(
  File "/app/api/services/app_generate_service.py", line 65, in generate
    return rate_limit.generate(AdvancedChatAppGenerator().generate(
  File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 122, in generate
    return self._generate(
  File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 236, in _generate
    conversation_variables = session.scalars(stmt).all()
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2470, in scalars
    return self._execute_internal(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2247, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
    result = conn.execute(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow__conversation_variables" does not exist
LINE 2: FROM workflow__conversation_variables
             ^

[SQL: SELECT workflow__conversation_variables.id, workflow__conversation_variables.conversation_id, workflow__conversation_variables.app_id, workflow__conversation_variables.data, workflow__conversation_variables.created_at, workflow__conversation_variables.updated_at
FROM workflow__conversation_variables
WHERE workflow__conversation_variables.app_id = %(app_id_1)s::UUID AND workflow__conversation_variables.conversation_id = %(conversation_id_1)s::UUID]
[parameters: {'app_id_1': '22e9b395-05a4-4622-a815-a94233bfb9e9', 'conversation_id_1': '94a91c13-0101-4eaa-bddc-3b242afc0a35'}]
(Background on this error at: https://sqlalche.me/e/20/f405)
2024-09-02 02:37:27,096.096 ERROR [Dummy-27] [app.py:838] - Exception on /console/api/apps/22e9b395-05a4-4622-a815-a94233bfb9e9/advanced-chat/workflows/draft/run [POST]
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation "workflow__conversation_variables" does not exist
LINE 2: FROM workflow__conversation_variables
             ^


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

Traceback (most recent call last):
  File "/app/api/controllers/console/app/workflow.py", line 174, in post
    response = AppGenerateService.generate(
  File "/app/api/services/app_generate_service.py", line 65, in generate
    return rate_limit.generate(AdvancedChatAppGenerator().generate(
  File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 122, in generate
    return self._generate(
  File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 236, in _generate
    conversation_variables = session.scalars(stmt).all()
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2470, in scalars
    return self._execute_internal(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2247, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
    result = conn.execute(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow__conversation_variables" does not exist
LINE 2: FROM workflow__conversation_variables
             ^

[SQL: SELECT workflow__conversation_variables.id, workflow__conversation_variables.conversation_id, workflow__conversation_variables.app_id, workflow__conversation_variables.data, workflow__conversation_variables.created_at, workflow__conversation_variables.updated_at
FROM workflow__conversation_variables
WHERE workflow__conversation_variables.app_id = %(app_id_1)s::UUID AND workflow__conversation_variables.conversation_id = %(conversation_id_1)s::UUID]
[parameters: {'app_id_1': '22e9b395-05a4-4622-a815-a94233bfb9e9', 'conversation_id_1': '94a91c13-0101-4eaa-bddc-3b242afc0a35'}]
(Background on this error at: https://sqlalche.me/e/20/f405)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
    resp = resource(*args, **kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]
  File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/app/api/controllers/console/setup.py", line 75, in decorated
    return view(*args, **kwargs)
  File "/app/api/libs/login.py", line 93, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
  File "/app/api/controllers/console/wraps.py", line 22, in decorated
    return view(*args, **kwargs)
  File "/app/api/controllers/console/app/wraps.py", line 49, in decorated_view
    return view_func(*args, **kwargs)
  File "/app/api/controllers/console/app/workflow.py", line 191, in post
    raise InternalServerError()
werkzeug.exceptions.InternalServerError: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

✔️ Expected Behavior

No response

Actual Behavior

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Originally created by @Sure0520 on GitHub (Sep 1, 2024). ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.7.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![image](https://github.com/user-attachments/assets/091ee5a6-561a-49af-b22c-2497e830df09) ``` 2024-09-02 02:37:27,095.095 ERROR [Dummy-27] [workflow.py:190] - internal server error. Traceback (most recent call last): File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedTable: relation "workflow__conversation_variables" does not exist LINE 2: FROM workflow__conversation_variables ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/api/controllers/console/app/workflow.py", line 174, in post response = AppGenerateService.generate( File "/app/api/services/app_generate_service.py", line 65, in generate return rate_limit.generate(AdvancedChatAppGenerator().generate( File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 122, in generate return self._generate( File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 236, in _generate conversation_variables = session.scalars(stmt).all() File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2470, in scalars return self._execute_internal( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2247, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement result = conn.execute( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute return meth( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection return connection._execute_clauseelement( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement ret = self._execute_context( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow__conversation_variables" does not exist LINE 2: FROM workflow__conversation_variables ^ [SQL: SELECT workflow__conversation_variables.id, workflow__conversation_variables.conversation_id, workflow__conversation_variables.app_id, workflow__conversation_variables.data, workflow__conversation_variables.created_at, workflow__conversation_variables.updated_at FROM workflow__conversation_variables WHERE workflow__conversation_variables.app_id = %(app_id_1)s::UUID AND workflow__conversation_variables.conversation_id = %(conversation_id_1)s::UUID] [parameters: {'app_id_1': '22e9b395-05a4-4622-a815-a94233bfb9e9', 'conversation_id_1': '94a91c13-0101-4eaa-bddc-3b242afc0a35'}] (Background on this error at: https://sqlalche.me/e/20/f405) 2024-09-02 02:37:27,096.096 ERROR [Dummy-27] [app.py:838] - Exception on /console/api/apps/22e9b395-05a4-4622-a815-a94233bfb9e9/advanced-chat/workflows/draft/run [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedTable: relation "workflow__conversation_variables" does not exist LINE 2: FROM workflow__conversation_variables ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/api/controllers/console/app/workflow.py", line 174, in post response = AppGenerateService.generate( File "/app/api/services/app_generate_service.py", line 65, in generate return rate_limit.generate(AdvancedChatAppGenerator().generate( File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 122, in generate return self._generate( File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 236, in _generate conversation_variables = session.scalars(stmt).all() File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2470, in scalars return self._execute_internal( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2247, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement result = conn.execute( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute return meth( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection return connection._execute_clauseelement( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement ret = self._execute_context( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "workflow__conversation_variables" does not exist LINE 2: FROM workflow__conversation_variables ^ [SQL: SELECT workflow__conversation_variables.id, workflow__conversation_variables.conversation_id, workflow__conversation_variables.app_id, workflow__conversation_variables.data, workflow__conversation_variables.created_at, workflow__conversation_variables.updated_at FROM workflow__conversation_variables WHERE workflow__conversation_variables.app_id = %(app_id_1)s::UUID AND workflow__conversation_variables.conversation_id = %(conversation_id_1)s::UUID] [parameters: {'app_id_1': '22e9b395-05a4-4622-a815-a94233bfb9e9', 'conversation_id_1': '94a91c13-0101-4eaa-bddc-3b242afc0a35'}] (Background on this error at: https://sqlalche.me/e/20/f405) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request rv = self.dispatch_request() File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) File "/app/api/controllers/console/setup.py", line 75, in decorated return view(*args, **kwargs) File "/app/api/libs/login.py", line 93, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) File "/app/api/controllers/console/wraps.py", line 22, in decorated return view(*args, **kwargs) File "/app/api/controllers/console/app/wraps.py", line 49, in decorated_view return view_func(*args, **kwargs) File "/app/api/controllers/console/app/workflow.py", line 191, in post raise InternalServerError() werkzeug.exceptions.InternalServerError: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
yindo added the 🌊 feat:workflow label 2026-02-21 18:10:28 -05:00
yindo closed this issue 2026-02-21 18:10:29 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 1, 2024):

Hey @Sure0520! I'm here to help you with any issues you're facing. I can assist with bug reports, answer questions, and guide you on becoming a contributor. Let me know how I can assist you!

I found a similar issue that might be related to your problem. The issue titled "Workflow results in FAIL status" was closed on June 18, 2024, by a pull request that fixed a null reference error [1].

To resolve the "relation 'workflow__conversation_variables' does not exist" error in your Dify 0.7.1 self-hosted (Docker) environment, follow these steps:

  1. Check Database Migrations: Ensure that all database migrations have been applied. Specifically, verify that the migration script 2024_08_13_0633-63a83fcf12ba_support_conversation_variables.py has been executed. This script creates the workflow__conversation_variables table.

  2. Run the Migration Script: If the migration has not been applied, manually run the migration script. The script includes the following commands to create the table:

    def upgrade():
        op.create_table('workflow__conversation_variables',
            sa.Column('id', models.types.StringUUID(), nullable=False),
            sa.Column('conversation_id', models.types.StringUUID(), nullable=False),
            sa.Column('app_id', models.types.StringUUID(), nullable=False),
            sa.Column('data', sa.Text(), nullable=False),
            sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
            sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
            sa.PrimaryKeyConstraint('id', 'conversation_id', name=op.f('workflow__conversation_variables_pkey'))
        )
        with op.batch_alter_table('workflow__conversation_variables', schema=None) as batch_op:
            batch_op.create_index(batch_op.f('workflow__conversation_variables_app_id_idx'), ['app_id'], unique=False)
            batch_op.create_index(batch_op.f('workflow__conversation_variables_created_at_idx'), ['created_at'], unique=False)
    
  3. Verify the Table Definition: Ensure that the table definition matches the expected schema in your application code. The ConversationVariable class in your code defines the table structure as follows:

    class ConversationVariable(db.Model):
        __tablename__ = 'workflow__conversation_variables'
    
        id: Mapped[str] = db.Column(StringUUID, primary_key=True)
        conversation_id: Mapped[str] = db.Column(StringUUID, nullable=False, primary_key=True)
        app_id: Mapped[str] = db.Column(StringUUID, nullable=False, index=True)
        data = db.Column(db.Text, nullable=False)
        created_at = db.Column(db.DateTime, nullable=False, index=True, server_default=db.text('CURRENT_TIMESTAMP(0)'))
        updated_at = db.Column(db.DateTime, nullable=False, server_default=func.current_timestamp(), onupdate=func.current_timestamp())
    

By ensuring that the workflow__conversation_variables table exists and matches the expected schema, you should be able to resolve the error [2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 1, 2024): <!-- Greeting --> Hey @Sure0520! I'm here to help you with any issues you're facing. I can assist with bug reports, answer questions, and guide you on becoming a contributor. Let me know how I can assist you! <!-- Answer --> I found a similar issue that might be related to your problem. The issue titled "[Workflow results in FAIL status](https://github.com/langgenius/dify/issues/5331)" was closed on June 18, 2024, by a pull request that fixed a null reference error <sup>[[1]](https://github.com/langgenius/dify/issues/5331)</sup>. To resolve the "relation 'workflow__conversation_variables' does not exist" error in your Dify 0.7.1 self-hosted (Docker) environment, follow these steps: 1. **Check Database Migrations**: Ensure that all database migrations have been applied. Specifically, verify that the migration script `2024_08_13_0633-63a83fcf12ba_support_conversation_variables.py` has been executed. This script creates the `workflow__conversation_variables` table. 2. **Run the Migration Script**: If the migration has not been applied, manually run the migration script. The script includes the following commands to create the table: ```python def upgrade(): op.create_table('workflow__conversation_variables', sa.Column('id', models.types.StringUUID(), nullable=False), sa.Column('conversation_id', models.types.StringUUID(), nullable=False), sa.Column('app_id', models.types.StringUUID(), nullable=False), sa.Column('data', sa.Text(), nullable=False), sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False), sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False), sa.PrimaryKeyConstraint('id', 'conversation_id', name=op.f('workflow__conversation_variables_pkey')) ) with op.batch_alter_table('workflow__conversation_variables', schema=None) as batch_op: batch_op.create_index(batch_op.f('workflow__conversation_variables_app_id_idx'), ['app_id'], unique=False) batch_op.create_index(batch_op.f('workflow__conversation_variables_created_at_idx'), ['created_at'], unique=False) ``` 3. **Verify the Table Definition**: Ensure that the table definition matches the expected schema in your application code. The `ConversationVariable` class in your code defines the table structure as follows: ```python class ConversationVariable(db.Model): __tablename__ = 'workflow__conversation_variables' id: Mapped[str] = db.Column(StringUUID, primary_key=True) conversation_id: Mapped[str] = db.Column(StringUUID, nullable=False, primary_key=True) app_id: Mapped[str] = db.Column(StringUUID, nullable=False, index=True) data = db.Column(db.Text, nullable=False) created_at = db.Column(db.DateTime, nullable=False, index=True, server_default=db.text('CURRENT_TIMESTAMP(0)')) updated_at = db.Column(db.DateTime, nullable=False, server_default=func.current_timestamp(), onupdate=func.current_timestamp()) ``` By ensuring that the `workflow__conversation_variables` table exists and matches the expected schema, you should be able to resolve the error <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/2024_08_13_0633-63a83fcf12ba_support_conversation_variables.py)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/api/models/workflow.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Sep 1, 2024):

Please upgrade to latest version and make sure you ran the migration.

@crazywoola commented on GitHub (Sep 1, 2024): Please upgrade to latest version and make sure you ran the migration.
Author
Owner

@Sure0520 commented on GitHub (Sep 1, 2024):

Please upgrade to latest version and make sure you ran the migration.

However, in version 0.7.2, the variable output using code cannot exceed 30 characters.

@Sure0520 commented on GitHub (Sep 1, 2024): > Please upgrade to latest version and make sure you ran the migration. However, in version 0.7.2, the variable output using code cannot exceed 30 characters.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5336