Internal Server Error #11960

Closed
opened 2026-02-21 19:04:59 -05:00 by yindo · 8 comments
Owner

Originally created by @watch-Ultra on GitHub (Mar 21, 2025).

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

1.1.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

✔️ Expected Behavior

Image

Actual Behavior

No response

Originally created by @watch-Ultra on GitHub (Mar 21, 2025). ### 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 1.1.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="1252" alt="Image" src="https://github.com/user-attachments/assets/fde1a0e7-e757-44a9-892c-ff6fe0fd5b5d" /> ### ✔️ Expected Behavior <img width="1252" alt="Image" src="https://github.com/user-attachments/assets/723febda-9857-404f-8d02-f67e1e9f8176" /> ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 19:04:59 -05:00
yindo closed this issue 2026-02-21 19:04:59 -05:00
Author
Owner

@watch-Ultra commented on GitHub (Mar 21, 2025):

Image
@watch-Ultra commented on GitHub (Mar 21, 2025): <img width="1259" alt="Image" src="https://github.com/user-attachments/assets/d7c99186-988a-417f-b06c-7afdc15ccb41" />
Author
Owner

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

Hello @watch-Ultra! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's tackle this together!

I found a similar unsolved discussion regarding a "dify internal server error" that might be relevant to your issue. You can view it here [1].

For the 500 Internal Server Error in the self-hosted Dify version 1.1.2 when using the external knowledge API, it could be caused by an unhandled exception in the ExternalKnowledgeHitTestingApi class. Specifically, in the post method, if an exception occurs during the call to HitTestingService.external_retrieve, it raises an InternalServerError with the exception message. To diagnose the specific cause, you would need to check the logs for the exact exception message being raised [2].

Additionally, ensure that your logging configuration is set up to capture detailed error information, which can help in diagnosing the issue. The Dify platform uses a logging mechanism that includes a rotating file handler, stream handler, and request ID filtering, among other features [3].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 21, 2025): <!-- Greeting --> Hello @watch-Ultra! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's tackle this together! <!-- Answer --> I found a similar unsolved discussion regarding a "dify internal server error" that might be relevant to your issue. You can view it [here](https://github.com/langgenius/dify/discussions/13897) <sup>[[1]](https://github.com/langgenius/dify/discussions/13897)</sup>. For the 500 Internal Server Error in the self-hosted Dify version 1.1.2 when using the external knowledge API, it could be caused by an unhandled exception in the `ExternalKnowledgeHitTestingApi` class. Specifically, in the `post` method, if an exception occurs during the call to `HitTestingService.external_retrieve`, it raises an `InternalServerError` with the exception message. To diagnose the specific cause, you would need to check the logs for the exact exception message being raised <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/controllers/console/datasets/external.py)</sup>. Additionally, ensure that your logging configuration is set up to capture detailed error information, which can help in diagnosing the issue. The Dify platform uses a logging mechanism that includes a rotating file handler, stream handler, and request ID filtering, among other features <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/extensions/ext_logging.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1ffacba4-3f4b-4df6-8d93-2b9332c26af6?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1ffacba4-3f4b-4df6-8d93-2b9332c26af6?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1ffacba4-3f4b-4df6-8d93-2b9332c26af6?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1ffacba4-3f4b-4df6-8d93-2b9332c26af6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1ffacba4-3f4b-4df6-8d93-2b9332c26af6?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/1ffacba4-3f4b-4df6-8d93-2b9332c26af6?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1ffacba4-3f4b-4df6-8d93-2b9332c26af6?feedback_type=other)</sup>
Author
Owner

@watch-Ultra commented on GitHub (Mar 21, 2025):

[SQL: SELECT datasets.id AS datasets_id, datasets.tenant_id AS datasets_tenant_id, datasets.name AS datasets_name, datasets.description AS datasets_description, datasets.provider AS datasets_provider, datasets.permission AS datasets_permission, datasets.data_source_type AS datasets_data_source_type, datasets.indexing_technique AS datasets_indexing_technique, datasets.index_struct AS datasets_index_struct, datasets.created_by AS datasets_created_by, datasets.created_at AS datasets_created_at, datasets.updated_by AS datasets_updated_by, datasets.updated_at AS datasets_updated_at, datasets.embedding_model AS datasets_embedding_model, datasets.embedding_model_provider AS datasets_embedding_model_provider, datasets.collection_binding_id AS datasets_collection_binding_id, datasets.retrieval_model AS datasets_retrieval_model, datasets.built_in_field_enabled AS datasets_built_in_field_enabled
FROM datasets
WHERE datasets.tenant_id = %(tenant_id_1)s::UUID AND (datasets.permission = %(permission_1)s OR datasets.permission = %(permission_2)s AND datasets.created_by = %(created_by_1)s::UUID) ORDER BY datasets.created_at DESC
 LIMIT %(param_1)s OFFSET %(param_2)s]
[parameters: {'tenant_id_1': 'bade56f1-ac51-4320-9d4b-20d5eb9f4543', 'permission_1': <DatasetPermissionEnum.ALL_TEAM: 'all_team_members'>, 'permission_2': <DatasetPermissionEnum.ONLY_ME: 'only_me'>, 'created_by_1': '430f5308-32f4-4416-ad22-3d537f97e53b', 'param_1': 30, 'param_2': 0}]
(Background on this error at: https://sqlalche.me/e/20/f405)
2025-03-21 15:40:54.354 ERROR [Dummy-2] [app.py:875] - Exception on /console/api/datasets [GET]
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedColumn: column datasets.built_in_field_enabled does not exist
LINE 1: ...sets.retrieval_model AS datasets_retrieval_model, datasets.b...
                                                             ^


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

Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, 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.12/site-packages/flask_restful/__init__.py", line 489, in wrapper
    resp = resource(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/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.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
    resp = meth(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/wraps.py", line 187, in decorated
    return view(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/libs/login.py", line 94, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/wraps.py", line 30, in decorated
    return view(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/wraps.py", line 199, in decorated
    return view(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/datasets/datasets.py", line 65, in get
    datasets, total = DatasetService.get_datasets(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/dataset_service.py", line 132, in get_datasets
    datasets = query.paginate(page=page, per_page=per_page, max_per_page=100, error_out=False)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask_sqlalchemy/query.py", line 98, in paginate
    return QueryPagination(
           ^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask_sqlalchemy/pagination.py", line 72, in __init__
    items = self._query_items()
            ^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask_sqlalchemy/pagination.py", line 358, in _query_items
    out = query.limit(self.per_page).offset(self._query_offset).all()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2673, in all
    return self._iter().all()  # type: ignore
           ^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2827, in _iter
    result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
                                                  ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2362, in execute
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/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.12/site-packages/sqlalchemy/orm/context.py", line 305, in orm_execute_statement
    result = conn.execute(
             ^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
           ^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/app/api/.venv/lib/python3.12/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.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column datasets.built_in_field_enabled does not exist
LINE 1: ...sets.retrieval_model AS datasets_retrieval_model, datasets.b...
                                                             ^

[SQL: SELECT datasets.id AS datasets_id, datasets.tenant_id AS datasets_tenant_id, datasets.name AS datasets_name, datasets.description AS datasets_description, datasets.provider AS datasets_provider, datasets.permission AS datasets_permission, datasets.data_source_type AS datasets_data_source_type, datasets.indexing_technique AS datasets_indexing_technique, datasets.index_struct AS datasets_index_struct, datasets.created_by AS datasets_created_by, datasets.created_at AS datasets_created_at, datasets.updated_by AS datasets_updated_by, datasets.updated_at AS datasets_updated_at, datasets.embedding_model AS datasets_embedding_model, datasets.embedding_model_provider AS datasets_embedding_model_provider, datasets.collection_binding_id AS datasets_collection_binding_id, datasets.retrieval_model AS datasets_retrieval_model, datasets.built_in_field_enabled AS datasets_built_in_field_enabled
FROM datasets
WHERE datasets.tenant_id = %(tenant_id_1)s::UUID AND (datasets.permission = %(permission_1)s OR datasets.permission = %(permission_2)s AND datasets.created_by = %(created_by_1)s::UUID) ORDER BY datasets.created_at DESC
 LIMIT %(param_1)s OFFSET %(param_2)s]
[parameters: {'tenant_id_1': 'bade56f1-ac51-4320-9d4b-20d5eb9f4543', 'permission_1': <DatasetPermissionEnum.ALL_TEAM: 'all_team_members'>, 'permission_2': <DatasetPermissionEnum.ONLY_ME: 'only_me'>, 'created_by_1': '430f5308-32f4-4416-ad22-3d537f97e53b', 'param_1': 30, 'param_2': 0}]
(Background on this error at: https://sqlalche.me/e/20/f405)
@watch-Ultra commented on GitHub (Mar 21, 2025): ``` [SQL: SELECT datasets.id AS datasets_id, datasets.tenant_id AS datasets_tenant_id, datasets.name AS datasets_name, datasets.description AS datasets_description, datasets.provider AS datasets_provider, datasets.permission AS datasets_permission, datasets.data_source_type AS datasets_data_source_type, datasets.indexing_technique AS datasets_indexing_technique, datasets.index_struct AS datasets_index_struct, datasets.created_by AS datasets_created_by, datasets.created_at AS datasets_created_at, datasets.updated_by AS datasets_updated_by, datasets.updated_at AS datasets_updated_at, datasets.embedding_model AS datasets_embedding_model, datasets.embedding_model_provider AS datasets_embedding_model_provider, datasets.collection_binding_id AS datasets_collection_binding_id, datasets.retrieval_model AS datasets_retrieval_model, datasets.built_in_field_enabled AS datasets_built_in_field_enabled FROM datasets WHERE datasets.tenant_id = %(tenant_id_1)s::UUID AND (datasets.permission = %(permission_1)s OR datasets.permission = %(permission_2)s AND datasets.created_by = %(created_by_1)s::UUID) ORDER BY datasets.created_at DESC LIMIT %(param_1)s OFFSET %(param_2)s] [parameters: {'tenant_id_1': 'bade56f1-ac51-4320-9d4b-20d5eb9f4543', 'permission_1': <DatasetPermissionEnum.ALL_TEAM: 'all_team_members'>, 'permission_2': <DatasetPermissionEnum.ONLY_ME: 'only_me'>, 'created_by_1': '430f5308-32f4-4416-ad22-3d537f97e53b', 'param_1': 30, 'param_2': 0}] (Background on this error at: https://sqlalche.me/e/20/f405) 2025-03-21 15:40:54.354 ERROR [Dummy-2] [app.py:875] - Exception on /console/api/datasets [GET] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedColumn: column datasets.built_in_field_enabled does not exist LINE 1: ...sets.retrieval_model AS datasets_retrieval_model, datasets.b... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, 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.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/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.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 187, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 94, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 30, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 199, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/datasets/datasets.py", line 65, in get datasets, total = DatasetService.get_datasets( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/dataset_service.py", line 132, in get_datasets datasets = query.paginate(page=page, per_page=per_page, max_per_page=100, error_out=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_sqlalchemy/query.py", line 98, in paginate return QueryPagination( ^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_sqlalchemy/pagination.py", line 72, in __init__ items = self._query_items() ^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_sqlalchemy/pagination.py", line 358, in _query_items out = query.limit(self.per_page).offset(self._query_offset).all() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2673, in all return self._iter().all() # type: ignore ^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2827, in _iter result: Union[ScalarResult[_T], Result[_T]] = self.session.execute( ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2362, in execute return self._execute_internal( ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/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.12/site-packages/sqlalchemy/orm/context.py", line 305, in orm_execute_statement result = conn.execute( ^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1418, in execute return meth( ^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection return connection._execute_clauseelement( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement ret = self._execute_context( ^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/app/api/.venv/lib/python3.12/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.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column datasets.built_in_field_enabled does not exist LINE 1: ...sets.retrieval_model AS datasets_retrieval_model, datasets.b... ^ [SQL: SELECT datasets.id AS datasets_id, datasets.tenant_id AS datasets_tenant_id, datasets.name AS datasets_name, datasets.description AS datasets_description, datasets.provider AS datasets_provider, datasets.permission AS datasets_permission, datasets.data_source_type AS datasets_data_source_type, datasets.indexing_technique AS datasets_indexing_technique, datasets.index_struct AS datasets_index_struct, datasets.created_by AS datasets_created_by, datasets.created_at AS datasets_created_at, datasets.updated_by AS datasets_updated_by, datasets.updated_at AS datasets_updated_at, datasets.embedding_model AS datasets_embedding_model, datasets.embedding_model_provider AS datasets_embedding_model_provider, datasets.collection_binding_id AS datasets_collection_binding_id, datasets.retrieval_model AS datasets_retrieval_model, datasets.built_in_field_enabled AS datasets_built_in_field_enabled FROM datasets WHERE datasets.tenant_id = %(tenant_id_1)s::UUID AND (datasets.permission = %(permission_1)s OR datasets.permission = %(permission_2)s AND datasets.created_by = %(created_by_1)s::UUID) ORDER BY datasets.created_at DESC LIMIT %(param_1)s OFFSET %(param_2)s] [parameters: {'tenant_id_1': 'bade56f1-ac51-4320-9d4b-20d5eb9f4543', 'permission_1': <DatasetPermissionEnum.ALL_TEAM: 'all_team_members'>, 'permission_2': <DatasetPermissionEnum.ONLY_ME: 'only_me'>, 'created_by_1': '430f5308-32f4-4416-ad22-3d537f97e53b', 'param_1': 30, 'param_2': 0}] (Background on this error at: https://sqlalche.me/e/20/f405) ```
Author
Owner

@watch-Ultra commented on GitHub (Mar 21, 2025):

@dosubot

@watch-Ultra commented on GitHub (Mar 21, 2025): @dosubot
Author
Owner

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

The error you're encountering is due to the datasets.built_in_field_enabled column not existing in the datasets table. To resolve this, you need to ensure that the column is present in your database schema. The column is defined in the Dataset model as follows:

built_in_field_enabled = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))

You can fix this by running a database migration to add the built_in_field_enabled column to the datasets table. If you're using a migration tool like Alembic, you would typically generate a new migration script and apply it to your database. Here's an example of what the SQL command might look like:

ALTER TABLE datasets ADD COLUMN built_in_field_enabled BOOLEAN NOT NULL DEFAULT FALSE;

Apply this migration to your database to resolve the error [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 21, 2025): <!-- Answer --> The error you're encountering is due to the `datasets.built_in_field_enabled` column not existing in the `datasets` table. To resolve this, you need to ensure that the column is present in your database schema. The column is defined in the `Dataset` model as follows: ```python built_in_field_enabled = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) ``` You can fix this by running a database migration to add the `built_in_field_enabled` column to the `datasets` table. If you're using a migration tool like Alembic, you would typically generate a new migration script and apply it to your database. Here's an example of what the SQL command might look like: ```sql ALTER TABLE datasets ADD COLUMN built_in_field_enabled BOOLEAN NOT NULL DEFAULT FALSE; ``` Apply this migration to your database to resolve the error <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/models/dataset.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/0fb97cc5-b26a-47df-9c32-07983d726fea?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/0fb97cc5-b26a-47df-9c32-07983d726fea?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/0fb97cc5-b26a-47df-9c32-07983d726fea?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/0fb97cc5-b26a-47df-9c32-07983d726fea?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0fb97cc5-b26a-47df-9c32-07983d726fea?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/0fb97cc5-b26a-47df-9c32-07983d726fea?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0fb97cc5-b26a-47df-9c32-07983d726fea?feedback_type=other)</sup>
Author
Owner

@claude89757 commented on GitHub (Apr 2, 2025):

I encountered the same issue. I am using the compose command to start Dify (1.1.3) on a new machine, but the volumes directory is using data from another machine with version 0.15.3.

@claude89757 commented on GitHub (Apr 2, 2025): I encountered the same issue. I am using the compose command to start Dify (1.1.3) on a new machine, but the volumes directory is using data from another machine with version 0.15.3.
Author
Owner

@maxruby commented on GitHub (Apr 11, 2025):

I am having a possibly related issue with a 502 due to Alembic migrations on version 0.15.2. It happened after a simple restart of the server as docker compose restarted again.

@maxruby commented on GitHub (Apr 11, 2025): I am having a possibly related issue with a 502 due to Alembic migrations on version 0.15.2. It happened after a simple restart of the server as docker compose restarted again.
Author
Owner

@prd-tuong-nguyen commented on GitHub (Jun 16, 2025):

same problem, how can you guys resolve it 😢

@prd-tuong-nguyen commented on GitHub (Jun 16, 2025): same problem, how can you guys resolve it 😢
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#11960