2025-03-15 09:10:04.797 UTC [96969] ERROR: invalid input syntax for type uuid: "" at character 745
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.0.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
When creating a custom tool, click on the test below to report this error. Below is the server log
2025-03-15 17:09:28 db-1 | 2025-03-15 09:09:28.928 UTC [96970] ERROR: invalid input syntax for type uuid: "" at character 745 2025-03-15 17:09:28 db-1 | 2025-03-15 09:09:28.928 UTC [96970] STATEMENT: SELECT accounts.id AS accounts_id, accounts.name AS accounts_name, accounts.email AS accounts_email, accounts.password AS accounts_password, accounts.password_salt AS accounts_password_salt, accounts.avatar AS accounts_avatar, accounts.interface_language AS accounts_interface_language, accounts.interface_theme AS accounts_interface_theme, accounts.timezone AS accounts_timezone, accounts.last_login_at AS accounts_last_login_at, accounts.last_login_ip AS accounts_last_login_ip, accounts.last_active_at AS accounts_last_active_at, accounts.status AS accounts_status, accounts.initialized_at AS accounts_initialized_at, accounts.created_at AS accounts_created_at, accounts.updated_at AS accounts_updated_at 2025-03-15 17:09:28 db-1 | FROM accounts 2025-03-15 17:09:28 db-1 | WHERE accounts.id = ''::UUID 2025-03-15 17:09:28 db-1 | LIMIT 1 2025-03-15 17:09:28 api-1 | 2025-03-15 09:09:28.928 ERROR [Dummy-294] [app.py:875] - Exception on /console/api/workspaces/current/tool-provider/api/test/pre [POST] 2025-03-15 17:09:28 api-1 | Traceback (most recent call last): 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-03-15 17:09:28 api-1 | self.dialect.do_execute( 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute 2025-03-15 17:09:28 api-1 | cursor.execute(statement, parameters) 2025-03-15 17:09:28 api-1 | psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type uuid: "" 2025-03-15 17:09:28 api-1 | LINE 3: WHERE accounts.id = ''::UUID 2025-03-15 17:09:28 api-1 | ^ 2025-03-15 17:09:28 api-1 | 2025-03-15 17:09:28 api-1 | 2025-03-15 17:09:28 api-1 | The above exception was the direct cause of the following exception: 2025-03-15 17:09:28 api-1 | 2025-03-15 17:09:28 api-1 | Traceback (most recent call last): 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request 2025-03-15 17:09:28 api-1 | rv = self.dispatch_request() 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request 2025-03-15 17:09:28 api-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/init.py", line 489, in wrapper 2025-03-15 17:09:28 api-1 | resp = resource(*args, **kwargs) 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view 2025-03-15 17:09:28 api-1 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/init.py", line 604, in dispatch_request 2025-03-15 17:09:28 api-1 | resp = meth(*args, **kwargs) 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/controllers/console/wraps.py", line 187, in decorated 2025-03-15 17:09:28 api-1 | return view(*args, **kwargs) 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/libs/login.py", line 94, in decorated_view 2025-03-15 17:09:28 api-1 | return current_app.ensure_sync(func)(*args, **kwargs) 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/controllers/console/wraps.py", line 30, in decorated 2025-03-15 17:09:28 api-1 | return view(*args, **kwargs) 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/controllers/console/workspace/tool_providers.py", line 369, in post 2025-03-15 17:09:28 api-1 | return ApiToolManageService.test_api_tool_preview( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 nginx-1 | 172.20.0.1 - - [15/Mar/2025:09:09:28 +0000] "POST /console/api/workspaces/current/tool-provider/api/test/pre HTTP/1.1" 500 56 "http://localhost/tools?category=api" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36" "-" 2025-03-15 17:09:28 api-1 | File "/app/api/services/tools/api_tools_manage_service.py", line 413, in test_api_tool_preview 2025-03-15 17:09:28 api-1 | provider_controller = ApiToolProviderController.from_db(db_provider, auth_type) 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/core/tools/custom_tool/provider.py", line 80, in from_db 2025-03-15 17:09:28 api-1 | user = db_provider.user 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/models/tools.py", line 105, in user 2025-03-15 17:09:28 api-1 | return db.session.query(Account).filter(Account.id == self.user_id).first() 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2728, in first 2025-03-15 17:09:28 api-1 | return self.limit(1)._iter().first() # type: ignore 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/query.py", line 2827, in _iter 2025-03-15 17:09:28 api-1 | result: Union[ScalarResult[_T], Result[_T]] = self.session.execute( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2362, in execute 2025-03-15 17:09:28 api-1 | return self._execute_internal( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2247, in _execute_internal 2025-03-15 17:09:28 api-1 | result: Result[Any] = compile_state_cls.orm_execute_statement( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 305, in orm_execute_statement 2025-03-15 17:09:28 api-1 | result = conn.execute( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1418, in execute 2025-03-15 17:09:28 api-1 | return meth( 2025-03-15 17:09:28 api-1 | ^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection 2025-03-15 17:09:28 api-1 | return connection._execute_clauseelement( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement 2025-03-15 17:09:28 api-1 | ret = self._execute_context( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context 2025-03-15 17:09:28 api-1 | return self._exec_single_context( 2025-03-15 17:09:28 api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context 2025-03-15 17:09:28 api-1 | self._handle_dbapi_exception( 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception 2025-03-15 17:09:28 api-1 | raise sqlalchemy_exception.with_traceback(exc_info[2]) from e 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context 2025-03-15 17:09:28 api-1 | self.dialect.do_execute( 2025-03-15 17:09:28 api-1 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute 2025-03-15 17:09:28 api-1 | cursor.execute(statement, parameters) 2025-03-15 17:09:28 api-1 | sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type uuid: "" 2025-03-15 17:09:28 api-1 | LINE 3: WHERE accounts.id = ''::UUID 2025-03-15 17:09:28 api-1 | ^ 2025-03-15 17:09:28 api-1 | 2025-03-15 17:09:28 api-1 | [SQL: SELECT accounts.id AS accounts_id, accounts.name AS accounts_name, accounts.email AS accounts_email, accounts.password AS accounts_password, accounts.password_salt AS accounts_password_salt, accounts.avatar AS accounts_avatar, accounts.interface_language AS accounts_interface_language, accounts.interface_theme AS accounts_interface_theme, accounts.timezone AS accounts_timezone, accounts.last_login_at AS accounts_last_login_at, accounts.last_login_ip AS accounts_last_login_ip, accounts.last_active_at AS accounts_last_active_at, accounts.status AS accounts_status, accounts.initialized_at AS accounts_initialized_at, accounts.created_at AS accounts_created_at, accounts.updated_at AS accounts_updated_at
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
Hey @biewen520! 👋 I'm here to help you with bugs, questions, and more while you wait for a human maintainer. Let's squash those bugs together!
To resolve the "invalid input syntax for type uuid" error in Dify version 1.0.1, you need to rebuild your Docker container with the latest code that includes the fix from PR #15606. Update your Docker build configuration to use the latest context:
build:
context: ../api
dockerfile: Dockerfile
restart: always
This should address the issue you're encountering when creating a custom tool with an OpenAPI specification [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