Error in getting node uuid data
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
v0.10.0-beta3
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
When I use node streams such as QR codes and charts to output file type data, an error occurs.
log output:
error code:
url = str(response.message) if response.message else None
ext = path.splitext(url)[1] if url else ".bin"
tool_file_id = response.save_as or str(url).split("/")[-1].split(".")[0]
transfer_method = response.meta.get("transfer_method", FileTransferMethod.TOOL_FILE)
✔️ Expected Behavior
Should correctly output uuid instead of saving type.
❌ Actual Behavior
The code failed and the file type was output.
The error you're encountering is due to an invalid input syntax for a UUID type in a SQL query. This happens when the system attempts to cast a non-UUID string, such as "image", to a UUID. This issue likely arises from incorrect handling of tool_response objects in the _extract_tool_response_binary method of the ToolNode class.
To resolve this, you should ensure that the UUIDs being used in the SQL queries are correctly extracted and validated before being used. Here are a few steps you can take:
-
Validate Input: Before using any input as a UUID in your SQL queries, validate that it is indeed a valid UUID. You can use Python's
uuidmodule to check if a string is a valid UUID. -
Check Data Flow: Review the data flow in the
_extract_tool_response_binarymethod to ensure that only valid UUIDs are being passed to the SQL query. This might involve checking the source of thetool_responseobjects and ensuring they contain the correct data. -
Error Handling: Implement error handling to catch and log instances where an invalid UUID is encountered. This can help in diagnosing the issue and preventing the application from crashing.
By ensuring that only valid UUIDs are used in your database operations, you should be able to prevent this error from occurring.
To continue talking to Dosu, mention @dosu.