Open tool page show " Internal Server Error" #15287

Closed
opened 2026-02-21 19:21:03 -05:00 by yindo · 12 comments
Owner

Originally created by @shy20221121 on GitHub (Jul 11, 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.6

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

✔️ Expected Behavior

The tool page can be opened normally

Actual Behavior

Image
Originally created by @shy20221121 on GitHub (Jul 11, 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.6 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="1870" height="468" alt="Image" src="https://github.com/user-attachments/assets/29b120ca-3e21-4e50-91b3-b64bc50acf15" /> ### ✔️ Expected Behavior The tool page can be opened normally ### ❌ Actual Behavior <img width="1870" height="468" alt="Image" src="https://github.com/user-attachments/assets/e10991b4-3697-424a-a043-ea0bcf604084" />
yindo added the 🐞 bug label 2026-02-21 19:21:03 -05:00
yindo closed this issue 2026-02-21 19:21:03 -05:00
Author
Owner

@shy20221121 commented on GitHub (Jul 11, 2025):

Other pages are normal

@shy20221121 commented on GitHub (Jul 11, 2025): Other pages are normal
Author
Owner

@crazywoola commented on GitHub (Jul 11, 2025):

Please provide the logs from the containers.

@crazywoola commented on GitHub (Jul 11, 2025): Please provide the logs from the containers.
Author
Owner

@shy20221121 commented on GitHub (Jul 11, 2025):

Please provide the logs from the containers.

Which container should I look at please?

I can't see the error logs in the container, but the browser's developer tools have the following error

Image Image Image
@shy20221121 commented on GitHub (Jul 11, 2025): > Please provide the logs from the containers. Which container should I look at please? I can't see the error logs in the container, but the browser's developer tools have the following error <img width="1192" height="378" alt="Image" src="https://github.com/user-attachments/assets/07e89325-ea4e-4277-afb0-f90430a37026" /> <img width="1885" height="924" alt="Image" src="https://github.com/user-attachments/assets/d8ebac4f-b5c3-4f30-9c7f-f4a950b4b864" /> <img width="647" height="115" alt="Image" src="https://github.com/user-attachments/assets/a2fe3f95-6a0a-4bdc-bfdb-231e82c4b9a5" />
Author
Owner

@shy20221121 commented on GitHub (Jul 11, 2025):

psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist
Image

@shy20221121 commented on GitHub (Jul 11, 2025): **psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist** <img width="1751" height="898" alt="Image" src="https://github.com/user-attachments/assets/339e0934-90f1-4237-aece-9f6e9feec489" />
Author
Owner

@shy20221121 commented on GitHub (Jul 11, 2025):

This error is also reported on the workflow editing page
Image

@shy20221121 commented on GitHub (Jul 11, 2025): This error is also reported on the workflow editing page <img width="1697" height="489" alt="Image" src="https://github.com/user-attachments/assets/ae412bbb-86cc-4c12-a83a-e0e00436ff0e" />
Author
Owner

@shiningxy commented on GitHub (Jul 14, 2025):

docker logs docker-db-1

PostgreSQL Database directory appears to contain a database; Skipping initialization

2025-07-14 04:52:54.073 UTC [1] LOG:  starting PostgreSQL 15.13 on x86_64-pc-linux-musl, compiled by gcc (Alpine 14.2.0) 14.2.0, 64-bit
2025-07-14 04:52:54.073 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2025-07-14 04:52:54.073 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2025-07-14 04:52:54.075 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-07-14 04:52:54.078 UTC [28] LOG:  database system was interrupted; last known up at 2025-07-14 04:36:38 UTC
2025-07-14 04:52:54.202 UTC [28] LOG:  database system was not properly shut down; automatic recovery in progress
2025-07-14 04:52:54.204 UTC [28] LOG:  redo starts at 2A/9E0FBF20
2025-07-14 04:52:54.204 UTC [28] LOG:  invalid record length at 2A/9E0FBF58: wanted 24, got 0
2025-07-14 04:52:54.204 UTC [28] LOG:  redo done at 2A/9E0FBF20 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2025-07-14 04:52:54.208 UTC [26] LOG:  checkpoint starting: end-of-recovery immediate wait
2025-07-14 04:52:54.218 UTC [26] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.007 s, sync=0.001 s, total=0.011 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB
2025-07-14 04:52:54.221 UTC [1] LOG:  database system is ready to accept connections
2025-07-14 04:53:07.889 UTC [124] ERROR:  relation "workflow_conversation_variables_conversation_id_idx" already exists
2025-07-14 04:53:07.889 UTC [124] STATEMENT:  CREATE INDEX workflow_conversation_variables_conversation_id_idx ON workflow_conversation_variables (conversation_id)
2025-07-14 04:53:29.954 UTC [267] ERROR:  relation "tool_mcp_providers" does not exist at character 825
2025-07-14 04:53:29.954 UTC [267] STATEMENT:  SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at 
        FROM tool_mcp_providers 
        WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name
2025-07-14 04:53:32.973 UTC [294] ERROR:  relation "tool_mcp_providers" does not exist at character 825
2025-07-14 04:53:32.973 UTC [294] STATEMENT:  SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at 
        FROM tool_mcp_providers 
        WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name
2025-07-14 04:53:34.263 UTC [293] ERROR:  relation "tool_mcp_providers" does not exist at character 825
2025-07-14 04:53:34.263 UTC [293] STATEMENT:  SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at 
        FROM tool_mcp_providers 
        WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name
2025-07-14 04:53:36.451 UTC [333] ERROR:  relation "tool_mcp_providers" does not exist at character 825
2025-07-14 04:53:36.451 UTC [333] STATEMENT:  SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at 
        FROM tool_mcp_providers 
        WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name
2025-07-14 04:53:40.706 UTC [299] ERROR:  relation "tool_mcp_providers" does not exist at character 825
2025-07-14 04:53:40.706 UTC [299] STATEMENT:  SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at 
        FROM tool_mcp_providers 
        WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name
@shiningxy commented on GitHub (Jul 14, 2025): # docker logs docker-db-1 ``` PostgreSQL Database directory appears to contain a database; Skipping initialization 2025-07-14 04:52:54.073 UTC [1] LOG: starting PostgreSQL 15.13 on x86_64-pc-linux-musl, compiled by gcc (Alpine 14.2.0) 14.2.0, 64-bit 2025-07-14 04:52:54.073 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2025-07-14 04:52:54.073 UTC [1] LOG: listening on IPv6 address "::", port 5432 2025-07-14 04:52:54.075 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2025-07-14 04:52:54.078 UTC [28] LOG: database system was interrupted; last known up at 2025-07-14 04:36:38 UTC 2025-07-14 04:52:54.202 UTC [28] LOG: database system was not properly shut down; automatic recovery in progress 2025-07-14 04:52:54.204 UTC [28] LOG: redo starts at 2A/9E0FBF20 2025-07-14 04:52:54.204 UTC [28] LOG: invalid record length at 2A/9E0FBF58: wanted 24, got 0 2025-07-14 04:52:54.204 UTC [28] LOG: redo done at 2A/9E0FBF20 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s 2025-07-14 04:52:54.208 UTC [26] LOG: checkpoint starting: end-of-recovery immediate wait 2025-07-14 04:52:54.218 UTC [26] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.007 s, sync=0.001 s, total=0.011 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB 2025-07-14 04:52:54.221 UTC [1] LOG: database system is ready to accept connections 2025-07-14 04:53:07.889 UTC [124] ERROR: relation "workflow_conversation_variables_conversation_id_idx" already exists 2025-07-14 04:53:07.889 UTC [124] STATEMENT: CREATE INDEX workflow_conversation_variables_conversation_id_idx ON workflow_conversation_variables (conversation_id) 2025-07-14 04:53:29.954 UTC [267] ERROR: relation "tool_mcp_providers" does not exist at character 825 2025-07-14 04:53:29.954 UTC [267] STATEMENT: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at FROM tool_mcp_providers WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name 2025-07-14 04:53:32.973 UTC [294] ERROR: relation "tool_mcp_providers" does not exist at character 825 2025-07-14 04:53:32.973 UTC [294] STATEMENT: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at FROM tool_mcp_providers WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name 2025-07-14 04:53:34.263 UTC [293] ERROR: relation "tool_mcp_providers" does not exist at character 825 2025-07-14 04:53:34.263 UTC [293] STATEMENT: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at FROM tool_mcp_providers WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name 2025-07-14 04:53:36.451 UTC [333] ERROR: relation "tool_mcp_providers" does not exist at character 825 2025-07-14 04:53:36.451 UTC [333] STATEMENT: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at FROM tool_mcp_providers WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name 2025-07-14 04:53:40.706 UTC [299] ERROR: relation "tool_mcp_providers" does not exist at character 825 2025-07-14 04:53:40.706 UTC [299] STATEMENT: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at FROM tool_mcp_providers WHERE tool_mcp_providers.tenant_id = 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'::UUID ORDER BY tool_mcp_providers.name ```
Author
Owner

@shiningxy commented on GitHub (Jul 14, 2025):

docker logs docker-api-1

Running migrations
2025-07-14 04:53:03.508 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
Preparing database migration...
Database migration skipped
[2025-07-14 04:53:08 +0000] [1] [INFO] Starting gunicorn 23.0.0
[2025-07-14 04:53:08 +0000] [1] [INFO] Listening at: http://0.0.0.0:5001 (1)
[2025-07-14 04:53:08 +0000] [1] [INFO] Using worker: gevent
[2025-07-14 04:53:08 +0000] [35] [INFO] Booting worker with pid: 35
[2025-07-14 04:53:08 +0000] [36] [INFO] Booting worker with pid: 36
[2025-07-14 04:53:08 +0000] [37] [INFO] Booting worker with pid: 37
[2025-07-14 04:53:08 +0000] [38] [INFO] Booting worker with pid: 38
[2025-07-14 04:53:08 +0000] [39] [INFO] Booting worker with pid: 39
[2025-07-14 04:53:08 +0000] [40] [INFO] Booting worker with pid: 40
[2025-07-14 04:53:08 +0000] [41] [INFO] Booting worker with pid: 41
[2025-07-14 04:53:09 +0000] [42] [INFO] Booting worker with pid: 42
[2025-07-14 04:53:09 +0000] [43] [INFO] Booting worker with pid: 43
[2025-07-14 04:53:09 +0000] [44] [INFO] Booting worker with pid: 44
[2025-07-14 04:53:09 +0000] [45] [INFO] Booting worker with pid: 45
[2025-07-14 04:53:09 +0000] [46] [INFO] Booting worker with pid: 46
[2025-07-14 04:53:09 +0000] [47] [INFO] Booting worker with pid: 47
[2025-07-14 04:53:09 +0000] [48] [INFO] Booting worker with pid: 48
[2025-07-14 04:53:09 +0000] [49] [INFO] Booting worker with pid: 49
2025-07-14 04:53:13.195 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:13.207 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:13.494 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:13.554 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:13.677 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:13.807 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:13.948 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:13.962 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:14.212 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:14.398 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:14.615 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:14.776 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:15.225 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:15.505 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:15.753 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads.
2025-07-14 04:53:29.955 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/workspaces/current/tool-providers [GET]
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1963, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist
LINE 2: FROM tool_mcp_providers 
             ^


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 210, in decorated
    return view(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/libs/login.py", line 61, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/wraps.py", line 31, in decorated
    return view(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/workspace/tool_providers.py", line 62, in get
    return ToolCommonService.list_tool_providers(user_id, tenant_id, args.get("type", None))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/tools/tools_manage_service.py", line 18, in list_tool_providers
    providers = ToolManager.list_providers_from_api(user_id, tenant_id, typ)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 657, in list_providers_from_api
    mcp_providers = MCPToolManageService.retrieve_mcp_tools(tenant_id, for_list=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/tools/mcp_tools_mange_service.py", line 105, in retrieve_mcp_tools
    .all()
     ^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2704, in all
    return self._iter().all()  # type: ignore
           ^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2857, 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 2365, in execute
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2251, 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 306, in orm_execute_statement
    result = conn.execute(
             ^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1415, in execute
    return meth(
           ^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 523, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1842, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1982, in _exec_single_context
    self._handle_dbapi_exception(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2351, 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 1963, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "tool_mcp_providers" does not exist
LINE 2: FROM tool_mcp_providers 
             ^

[SQL: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at 
FROM tool_mcp_providers 
WHERE tool_mcp_providers.tenant_id = %(tenant_id_1)s::UUID ORDER BY tool_mcp_providers.name]
[parameters: {'tenant_id_1': 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'}]
(Background on this error at: https://sqlalche.me/e/20/f405)
2025-07-14 04:53:32.973 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/workspaces/current/tool-providers [GET]
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1963, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist
LINE 2: FROM tool_mcp_providers 
             ^


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 210, in decorated
    return view(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/libs/login.py", line 61, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/wraps.py", line 31, in decorated
    return view(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/controllers/console/workspace/tool_providers.py", line 62, in get
    return ToolCommonService.list_tool_providers(user_id, tenant_id, args.get("type", None))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/tools/tools_manage_service.py", line 18, in list_tool_providers
    providers = ToolManager.list_providers_from_api(user_id, tenant_id, typ)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 657, in list_providers_from_api
    mcp_providers = MCPToolManageService.retrieve_mcp_tools(tenant_id, for_list=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/tools/mcp_tools_mange_service.py", line 105, in retrieve_mcp_tools
    .all()
     ^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2704, in all
    return self._iter().all()  # type: ignore
           ^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2857, 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 2365, in execute
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2251, 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 306, in orm_execute_statement
    result = conn.execute(
             ^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1415, in execute
    return meth(
           ^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 523, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1842, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1982, in _exec_single_context
    self._handle_dbapi_exception(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2351, 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 1963, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "tool_mcp_providers" does not exist
LINE 2: FROM tool_mcp_providers 
             ^

[SQL: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at 
FROM tool_mcp_providers 
WHERE tool_mcp_providers.tenant_id = %(tenant_id_1)s::UUID ORDER BY tool_mcp_providers.name]
[parameters: {'tenant_id_1': 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'}]
(Background on this error at: https://sqlalche.me/e/20/f405)
2025-07-14 04:53:34.264 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/workspaces/current/tool-providers [GET]
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1963, in _exec_single_context
    self.dialect.do_execute(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist
LINE 2: FROM tool_mcp_providers 
@shiningxy commented on GitHub (Jul 14, 2025): # docker logs docker-api-1 ``` Running migrations 2025-07-14 04:53:03.508 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. Preparing database migration... Database migration skipped [2025-07-14 04:53:08 +0000] [1] [INFO] Starting gunicorn 23.0.0 [2025-07-14 04:53:08 +0000] [1] [INFO] Listening at: http://0.0.0.0:5001 (1) [2025-07-14 04:53:08 +0000] [1] [INFO] Using worker: gevent [2025-07-14 04:53:08 +0000] [35] [INFO] Booting worker with pid: 35 [2025-07-14 04:53:08 +0000] [36] [INFO] Booting worker with pid: 36 [2025-07-14 04:53:08 +0000] [37] [INFO] Booting worker with pid: 37 [2025-07-14 04:53:08 +0000] [38] [INFO] Booting worker with pid: 38 [2025-07-14 04:53:08 +0000] [39] [INFO] Booting worker with pid: 39 [2025-07-14 04:53:08 +0000] [40] [INFO] Booting worker with pid: 40 [2025-07-14 04:53:08 +0000] [41] [INFO] Booting worker with pid: 41 [2025-07-14 04:53:09 +0000] [42] [INFO] Booting worker with pid: 42 [2025-07-14 04:53:09 +0000] [43] [INFO] Booting worker with pid: 43 [2025-07-14 04:53:09 +0000] [44] [INFO] Booting worker with pid: 44 [2025-07-14 04:53:09 +0000] [45] [INFO] Booting worker with pid: 45 [2025-07-14 04:53:09 +0000] [46] [INFO] Booting worker with pid: 46 [2025-07-14 04:53:09 +0000] [47] [INFO] Booting worker with pid: 47 [2025-07-14 04:53:09 +0000] [48] [INFO] Booting worker with pid: 48 [2025-07-14 04:53:09 +0000] [49] [INFO] Booting worker with pid: 49 2025-07-14 04:53:13.195 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:13.207 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:13.494 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:13.554 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:13.677 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:13.807 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:13.948 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:13.962 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:14.212 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:14.398 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:14.615 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:14.776 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:15.225 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:15.505 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:15.753 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 12 threads. 2025-07-14 04:53:29.955 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/workspaces/current/tool-providers [GET] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1963, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist LINE 2: FROM tool_mcp_providers ^ 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 210, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 61, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 31, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/workspace/tool_providers.py", line 62, in get return ToolCommonService.list_tool_providers(user_id, tenant_id, args.get("type", None)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/tools/tools_manage_service.py", line 18, in list_tool_providers providers = ToolManager.list_providers_from_api(user_id, tenant_id, typ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 657, in list_providers_from_api mcp_providers = MCPToolManageService.retrieve_mcp_tools(tenant_id, for_list=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/tools/mcp_tools_mange_service.py", line 105, in retrieve_mcp_tools .all() ^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2704, in all return self._iter().all() # type: ignore ^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2857, 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 2365, in execute return self._execute_internal( ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2251, 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 306, in orm_execute_statement result = conn.execute( ^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1415, in execute return meth( ^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 523, in _execute_on_connection return connection._execute_clauseelement( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement ret = self._execute_context( ^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1842, in _execute_context return self._exec_single_context( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1982, in _exec_single_context self._handle_dbapi_exception( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2351, 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 1963, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "tool_mcp_providers" does not exist LINE 2: FROM tool_mcp_providers ^ [SQL: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at FROM tool_mcp_providers WHERE tool_mcp_providers.tenant_id = %(tenant_id_1)s::UUID ORDER BY tool_mcp_providers.name] [parameters: {'tenant_id_1': 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'}] (Background on this error at: https://sqlalche.me/e/20/f405) 2025-07-14 04:53:32.973 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/workspaces/current/tool-providers [GET] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1963, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist LINE 2: FROM tool_mcp_providers ^ 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 210, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 61, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 31, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/workspace/tool_providers.py", line 62, in get return ToolCommonService.list_tool_providers(user_id, tenant_id, args.get("type", None)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/tools/tools_manage_service.py", line 18, in list_tool_providers providers = ToolManager.list_providers_from_api(user_id, tenant_id, typ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 657, in list_providers_from_api mcp_providers = MCPToolManageService.retrieve_mcp_tools(tenant_id, for_list=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/tools/mcp_tools_mange_service.py", line 105, in retrieve_mcp_tools .all() ^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2704, in all return self._iter().all() # type: ignore ^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2857, 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 2365, in execute return self._execute_internal( ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2251, 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 306, in orm_execute_statement result = conn.execute( ^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1415, in execute return meth( ^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 523, in _execute_on_connection return connection._execute_clauseelement( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement ret = self._execute_context( ^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1842, in _execute_context return self._exec_single_context( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1982, in _exec_single_context self._handle_dbapi_exception( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2351, 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 1963, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "tool_mcp_providers" does not exist LINE 2: FROM tool_mcp_providers ^ [SQL: SELECT tool_mcp_providers.id AS tool_mcp_providers_id, tool_mcp_providers.name AS tool_mcp_providers_name, tool_mcp_providers.server_identifier AS tool_mcp_providers_server_identifier, tool_mcp_providers.server_url AS tool_mcp_providers_server_url, tool_mcp_providers.server_url_hash AS tool_mcp_providers_server_url_hash, tool_mcp_providers.icon AS tool_mcp_providers_icon, tool_mcp_providers.tenant_id AS tool_mcp_providers_tenant_id, tool_mcp_providers.user_id AS tool_mcp_providers_user_id, tool_mcp_providers.encrypted_credentials AS tool_mcp_providers_encrypted_credentials, tool_mcp_providers.authed AS tool_mcp_providers_authed, tool_mcp_providers.tools AS tool_mcp_providers_tools, tool_mcp_providers.created_at AS tool_mcp_providers_created_at, tool_mcp_providers.updated_at AS tool_mcp_providers_updated_at FROM tool_mcp_providers WHERE tool_mcp_providers.tenant_id = %(tenant_id_1)s::UUID ORDER BY tool_mcp_providers.name] [parameters: {'tenant_id_1': 'fa56dd1c-9c61-4db8-a944-cb6c8e4f493a'}] (Background on this error at: https://sqlalche.me/e/20/f405) 2025-07-14 04:53:34.264 ERROR [Dummy-1] [app.py:875] - Exception on /console/api/workspaces/current/tool-providers [GET] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1963, in _exec_single_context self.dialect.do_execute( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 943, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedTable: relation "tool_mcp_providers" does not exist LINE 2: FROM tool_mcp_providers ```
Author
Owner

@shiningxy commented on GitHub (Jul 14, 2025):

@crazywoola seem like database migration problem.

@shiningxy commented on GitHub (Jul 14, 2025): @crazywoola seem like database migration problem.
Author
Owner

@shiningxy commented on GitHub (Jul 14, 2025):

i encount this problem while upgrade 1.4.3 to 1.6.0

refer to #22008

i fix this problem as above steps:

Step 1: Check Database Migration History

$ docker exec -it docker-api-1 flask db history
0ab65e1cc7fa -> 58eb7bdb93fe (head), add mcp server tool and app server
4474872b0ee6 -> 0ab65e1cc7fa, remove sequence_number from workflow_runs
2adcbe1f5dfb -> 4474872b0ee6, `workflow_draft_varaibles` add `node_execution_id` column, add an index for `workflow_node_executions`.
d28f2004b072 -> 2adcbe1f5dfb, add WorkflowDraftVariable model
6a9f914f656c -> d28f2004b072, add index for workflow_conversation_variables.conversation_id
d20049ed0af6 -> 6a9f914f656c, change documentsegment and childchunk indexes

Step 2: Stamp Database to Head Version

$ docker exec -it docker-api-1 flask db stamp head

Step 3: migration

docker exec -it docker-api-1  flask db upgrade

or mock

api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py
api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py
api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py

RUN SQL ABOVE

-- 1. api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py
DROP TABLE "public"."workflow_draft_variables";
CREATE TABLE "public"."workflow_draft_variables" (
    id UUID NOT NULL DEFAULT uuid_generate_v4(),
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    app_id UUID NOT NULL,
    last_edited_at TIMESTAMP,
    node_id VARCHAR(255) NOT NULL,
    name VARCHAR(255) NOT NULL,
    description VARCHAR(255) NOT NULL,
    selector VARCHAR(255) NOT NULL,
    value_type VARCHAR(20) NOT NULL,
    value TEXT NOT NULL,
    visible BOOLEAN NOT NULL,
    editable BOOLEAN NOT NULL,
    node_execution_id UUID,
    
    CONSTRAINT workflow_draft_variables_pkey PRIMARY KEY (id),
    CONSTRAINT workflow_draft_variables_app_node_name_unique UNIQUE (app_id, node_id, name)
);

-- 2. api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py
DROP INDEX IF EXISTS workflow_run_tenant_app_sequence_idx;

ALTER TABLE workflow_runs DROP COLUMN IF EXISTS sequence_number;


-- 3. api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py
CREATE TABLE app_mcp_servers (
    id UUID NOT NULL DEFAULT uuid_generate_v4(),
    tenant_id UUID NOT NULL,
    app_id UUID NOT NULL,
    name VARCHAR(255) NOT NULL,
    description VARCHAR(255) NOT NULL,
    server_code VARCHAR(255) NOT NULL,
    status VARCHAR(255) NOT NULL DEFAULT 'normal'::character varying,
    parameters TEXT NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    
    CONSTRAINT app_mcp_server_pkey PRIMARY KEY (id),
    CONSTRAINT unique_app_mcp_server_tenant_app_id UNIQUE (tenant_id, app_id),
    CONSTRAINT unique_app_mcp_server_server_code UNIQUE (server_code)
);

CREATE TABLE tool_mcp_providers (
    id UUID NOT NULL DEFAULT uuid_generate_v4(),
    name VARCHAR(40) NOT NULL,
    server_identifier VARCHAR(24) NOT NULL,
    server_url TEXT NOT NULL,
    server_url_hash VARCHAR(64) NOT NULL,
    icon VARCHAR(255),
    tenant_id UUID NOT NULL,
    user_id UUID NOT NULL,
    encrypted_credentials TEXT,
    authed BOOLEAN NOT NULL,
    tools TEXT NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    
    CONSTRAINT tool_mcp_provider_pkey PRIMARY KEY (id),
    CONSTRAINT unique_mcp_provider_name UNIQUE (tenant_id, name),
    CONSTRAINT unique_mcp_provider_server_identifier UNIQUE (tenant_id, server_identifier),
    CONSTRAINT unique_mcp_provider_server_url UNIQUE (tenant_id, server_url_hash)
);

Step 4: Execute Docker Compose Version Upgrade
Follow the standard Docker Compose version upgrade guide after completing the database migration.

@shiningxy commented on GitHub (Jul 14, 2025): i encount this problem while upgrade 1.4.3 to 1.6.0 refer to #22008 i fix this problem as above steps: Step 1: Check Database Migration History ``` $ docker exec -it docker-api-1 flask db history 0ab65e1cc7fa -> 58eb7bdb93fe (head), add mcp server tool and app server 4474872b0ee6 -> 0ab65e1cc7fa, remove sequence_number from workflow_runs 2adcbe1f5dfb -> 4474872b0ee6, `workflow_draft_varaibles` add `node_execution_id` column, add an index for `workflow_node_executions`. d28f2004b072 -> 2adcbe1f5dfb, add WorkflowDraftVariable model 6a9f914f656c -> d28f2004b072, add index for workflow_conversation_variables.conversation_id d20049ed0af6 -> 6a9f914f656c, change documentsegment and childchunk indexes ``` Step 2: Stamp Database to Head Version ``` $ docker exec -it docker-api-1 flask db stamp head ``` Step 3: migration ``` docker exec -it docker-api-1 flask db upgrade ``` or mock `api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py` `api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py` `api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py` RUN SQL ABOVE ``` -- 1. api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py DROP TABLE "public"."workflow_draft_variables"; CREATE TABLE "public"."workflow_draft_variables" ( id UUID NOT NULL DEFAULT uuid_generate_v4(), created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, app_id UUID NOT NULL, last_edited_at TIMESTAMP, node_id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, selector VARCHAR(255) NOT NULL, value_type VARCHAR(20) NOT NULL, value TEXT NOT NULL, visible BOOLEAN NOT NULL, editable BOOLEAN NOT NULL, node_execution_id UUID, CONSTRAINT workflow_draft_variables_pkey PRIMARY KEY (id), CONSTRAINT workflow_draft_variables_app_node_name_unique UNIQUE (app_id, node_id, name) ); -- 2. api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py DROP INDEX IF EXISTS workflow_run_tenant_app_sequence_idx; ALTER TABLE workflow_runs DROP COLUMN IF EXISTS sequence_number; -- 3. api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py CREATE TABLE app_mcp_servers ( id UUID NOT NULL DEFAULT uuid_generate_v4(), tenant_id UUID NOT NULL, app_id UUID NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, server_code VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL DEFAULT 'normal'::character varying, parameters TEXT NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT app_mcp_server_pkey PRIMARY KEY (id), CONSTRAINT unique_app_mcp_server_tenant_app_id UNIQUE (tenant_id, app_id), CONSTRAINT unique_app_mcp_server_server_code UNIQUE (server_code) ); CREATE TABLE tool_mcp_providers ( id UUID NOT NULL DEFAULT uuid_generate_v4(), name VARCHAR(40) NOT NULL, server_identifier VARCHAR(24) NOT NULL, server_url TEXT NOT NULL, server_url_hash VARCHAR(64) NOT NULL, icon VARCHAR(255), tenant_id UUID NOT NULL, user_id UUID NOT NULL, encrypted_credentials TEXT, authed BOOLEAN NOT NULL, tools TEXT NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT tool_mcp_provider_pkey PRIMARY KEY (id), CONSTRAINT unique_mcp_provider_name UNIQUE (tenant_id, name), CONSTRAINT unique_mcp_provider_server_identifier UNIQUE (tenant_id, server_identifier), CONSTRAINT unique_mcp_provider_server_url UNIQUE (tenant_id, server_url_hash) ); ``` Step 4: Execute Docker Compose Version Upgrade Follow the standard Docker Compose version upgrade guide after completing the database migration.
Author
Owner

@leoliu0730 commented on GitHub (Jul 14, 2025):

我在将 1.4.3 升级到 1.6.0 时计算了这个问题

请参阅 #22008

我按照上述步骤解决了这个问题:

第 1 步:检查数据库迁移历史记录

$ docker exec -it docker-api-1 flask db history
0ab65e1cc7fa -> 58eb7bdb93fe (head), add mcp server tool and app server
4474872b0ee6 -> 0ab65e1cc7fa, remove sequence_number from workflow_runs
2adcbe1f5dfb -> 4474872b0ee6, `workflow_draft_varaibles` add `node_execution_id` column, add an index for `workflow_node_executions`.
d28f2004b072 -> 2adcbe1f5dfb, add WorkflowDraftVariable model
6a9f914f656c -> d28f2004b072, add index for workflow_conversation_variables.conversation_id
d20049ed0af6 -> 6a9f914f656c, change documentsegment and childchunk indexes

第 2 步:将邮票数据库转换为头部版本

$ docker exec -it docker-api-1 flask db stamp head

第 3 步:运行 SQL 以模拟迁移.py api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py

-- 1. api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py
DROP TABLE "public"."workflow_draft_variables";
CREATE TABLE "public"."workflow_draft_variables" (
    "id" uuid NOT NULL DEFAULT uuid_generate_v4(),
    "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "app_id" uuid NOT NULL,
    "last_edited_at" timestamp,
    "node_id" varchar(255) NOT NULL,
    "name" varchar(255) NOT NULL,
    "description" varchar(255) NOT NULL,
    "selector" varchar(255) NOT NULL,
    "value_type" varchar(20) NOT NULL,
    "value" text NOT NULL,
    "visible" bool NOT NULL,
    "editable" bool NOT NULL,
    "node_execution_id" uuid,
    PRIMARY KEY ("id")
);

-- 2. api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py
DROP INDEX IF EXISTS workflow_run_tenant_app_sequence_idx;

ALTER TABLE workflow_runs DROP COLUMN IF EXISTS sequence_number;


-- 3. api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py
CREATE TABLE app_mcp_servers (
    id UUID NOT NULL DEFAULT uuid_generate_v4(),
    tenant_id UUID NOT NULL,
    app_id UUID NOT NULL,
    name VARCHAR(255) NOT NULL,
    description VARCHAR(255) NOT NULL,
    server_code VARCHAR(255) NOT NULL,
    status VARCHAR(255) NOT NULL DEFAULT 'normal'::character varying,
    parameters TEXT NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    
    CONSTRAINT app_mcp_server_pkey PRIMARY KEY (id),
    CONSTRAINT unique_app_mcp_server_tenant_app_id UNIQUE (tenant_id, app_id),
    CONSTRAINT unique_app_mcp_server_server_code UNIQUE (server_code)
);

CREATE TABLE tool_mcp_providers (
    id UUID NOT NULL DEFAULT uuid_generate_v4(),
    name VARCHAR(40) NOT NULL,
    server_identifier VARCHAR(24) NOT NULL,
    server_url TEXT NOT NULL,
    server_url_hash VARCHAR(64) NOT NULL,
    icon VARCHAR(255),
    tenant_id UUID NOT NULL,
    user_id UUID NOT NULL,
    encrypted_credentials TEXT,
    authed BOOLEAN NOT NULL,
    tools TEXT NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    
    CONSTRAINT tool_mcp_provider_pkey PRIMARY KEY (id),
    CONSTRAINT unique_mcp_provider_name UNIQUE (tenant_id, name),
    CONSTRAINT unique_mcp_provider_server_identifier UNIQUE (tenant_id, server_identifier),
    CONSTRAINT unique_mcp_provider_server_url UNIQUE (tenant_id, server_url_hash)
);

Step 4: Execute Docker Compose Version Upgrade Follow the standard Docker Compose version upgrade guide after completing the database migration.

Is the code in Step 3 manually added to the .py file, and then just execute docker compose up -d?

@leoliu0730 commented on GitHub (Jul 14, 2025): > 我在将 1.4.3 升级到 1.6.0 时计算了这个问题 > > 请参阅 [#22008](https://github.com/langgenius/dify/issues/22008) > > 我按照上述步骤解决了这个问题: > > 第 1 步:检查数据库迁移历史记录 > > ``` > $ docker exec -it docker-api-1 flask db history > 0ab65e1cc7fa -> 58eb7bdb93fe (head), add mcp server tool and app server > 4474872b0ee6 -> 0ab65e1cc7fa, remove sequence_number from workflow_runs > 2adcbe1f5dfb -> 4474872b0ee6, `workflow_draft_varaibles` add `node_execution_id` column, add an index for `workflow_node_executions`. > d28f2004b072 -> 2adcbe1f5dfb, add WorkflowDraftVariable model > 6a9f914f656c -> d28f2004b072, add index for workflow_conversation_variables.conversation_id > d20049ed0af6 -> 6a9f914f656c, change documentsegment and childchunk indexes > ``` > > 第 2 步:将邮票数据库转换为头部版本 > > ``` > $ docker exec -it docker-api-1 flask db stamp head > ``` > > 第 3 步:运行 SQL 以模拟迁移.py `api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py` `api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py` `api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py` > > ``` > -- 1. api/migrations/versions/2025_06_06_1424-4474872b0ee6_workflow_draft_varaibles_add_node_execution_id.py > DROP TABLE "public"."workflow_draft_variables"; > CREATE TABLE "public"."workflow_draft_variables" ( > "id" uuid NOT NULL DEFAULT uuid_generate_v4(), > "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, > "updated_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, > "app_id" uuid NOT NULL, > "last_edited_at" timestamp, > "node_id" varchar(255) NOT NULL, > "name" varchar(255) NOT NULL, > "description" varchar(255) NOT NULL, > "selector" varchar(255) NOT NULL, > "value_type" varchar(20) NOT NULL, > "value" text NOT NULL, > "visible" bool NOT NULL, > "editable" bool NOT NULL, > "node_execution_id" uuid, > PRIMARY KEY ("id") > ); > > -- 2. api/migrations/versions/2025_06_19_1633-0ab65e1cc7fa_remove_sequence_number_from_workflow_.py > DROP INDEX IF EXISTS workflow_run_tenant_app_sequence_idx; > > ALTER TABLE workflow_runs DROP COLUMN IF EXISTS sequence_number; > > > -- 3. api/migrations/versions/2025_06_25_0936-58eb7bdb93fe_add_mcp_server_tool_and_app_server.py > CREATE TABLE app_mcp_servers ( > id UUID NOT NULL DEFAULT uuid_generate_v4(), > tenant_id UUID NOT NULL, > app_id UUID NOT NULL, > name VARCHAR(255) NOT NULL, > description VARCHAR(255) NOT NULL, > server_code VARCHAR(255) NOT NULL, > status VARCHAR(255) NOT NULL DEFAULT 'normal'::character varying, > parameters TEXT NOT NULL, > created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, > updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, > > CONSTRAINT app_mcp_server_pkey PRIMARY KEY (id), > CONSTRAINT unique_app_mcp_server_tenant_app_id UNIQUE (tenant_id, app_id), > CONSTRAINT unique_app_mcp_server_server_code UNIQUE (server_code) > ); > > CREATE TABLE tool_mcp_providers ( > id UUID NOT NULL DEFAULT uuid_generate_v4(), > name VARCHAR(40) NOT NULL, > server_identifier VARCHAR(24) NOT NULL, > server_url TEXT NOT NULL, > server_url_hash VARCHAR(64) NOT NULL, > icon VARCHAR(255), > tenant_id UUID NOT NULL, > user_id UUID NOT NULL, > encrypted_credentials TEXT, > authed BOOLEAN NOT NULL, > tools TEXT NOT NULL, > created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, > updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, > > CONSTRAINT tool_mcp_provider_pkey PRIMARY KEY (id), > CONSTRAINT unique_mcp_provider_name UNIQUE (tenant_id, name), > CONSTRAINT unique_mcp_provider_server_identifier UNIQUE (tenant_id, server_identifier), > CONSTRAINT unique_mcp_provider_server_url UNIQUE (tenant_id, server_url_hash) > ); > ``` > > Step 4: Execute Docker Compose Version Upgrade Follow the standard Docker Compose version upgrade guide after completing the database migration. Is the code in Step 3 manually added to the .py file, and then just execute docker compose up -d?
Author
Owner

@shiningxy commented on GitHub (Jul 14, 2025):

docker exec -it docker-api-1  flask db upgrade

is runs on the host, outside of the docker container

The sql is runs on database.

after that, i think it need to execute docker compose down & docker compose up -d

@shiningxy commented on GitHub (Jul 14, 2025): ``` docker exec -it docker-api-1 flask db upgrade ``` is runs on the host, outside of the docker container The sql is runs on database. after that, i think it need to execute `docker compose down` & `docker compose up -d`
Author
Owner

@crazywoola commented on GitHub (Jul 16, 2025):

Glad you solved it. :)

@crazywoola commented on GitHub (Jul 16, 2025): Glad you solved it. :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15287