[bug] workflow as tool files field return is empty #18532

Closed
opened 2026-02-21 19:48:48 -05:00 by yindo · 0 comments
Owner

Originally created by @CrabSAMA on GitHub (Sep 29, 2025).

Originally assigned to: @CrabSAMA on GitHub.

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. create a new workflow, add one generate file plugin, I use md_exporter
Image

md_exporter tool files field have correct return

  1. publish this workflow to tool
  2. add this tool at another workflow and run it, watch the common tool field files, and it will found nothing
Image

log here:

[on_tool_execution]
Tool: md_to_pdf
Outputs: {"type":"blob","message":{"blob":"JVBERi0xLjQKJZOMi54gUmVwb3J0TGFiIEdlbmVyYXRlZCBQREYgZG9jdW1lbnQgaHR0cDovL3d3dy5yZXBvcnRsYWIuY29tCjEgMCBvYmoKPDwKL0YxIDIgMCBSIC9GMiAzIDAgUgo+PgplbmRvYmoKMiAwIG9iago8PAovQmFzZUZvbnQgL0hlbHZldGljYSAvRW5jb2RpbmcgL1dpbkFuc2lFbmNvZGluZyAvTmFtZSAvRjEgL1N1YnR5cGUgL1R5cGUxIC9UeXBlIC9Gb250Cj4+CmVuZG9iagozIDAgb2JqCjw8Ci9CYXNlRm9udCAvSGVsdmV0aWNhLUJvbGQgL0VuY29kaW5nIC9XaW5BbnNpRW5jb2RpbmcgL05hbWUgL0YyIC9TdWJ0eXBlIC9UeXBlMSAvVHlwZSAvRm9udAo+PgplbmRvYmoKNCAwIG9iago8PAovQ29udGVudHMgMTEgMCBSIC9NZWRpYUJveCBbIDAgMCA1OTUuMjc1NiA4NDEuODg5OCBdIC9QYXJlbnQgMTAgMCBSIC9SZXNvdXJjZXMgPDwKL0ZvbnQgMSAwIFIgL1Byb2NTZXQgWyAvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJIF0KPj4gL1JvdGF0ZSAwIC9UcmFucyA8PAoKPj4gCiAgL1R5cGUgL1BhZ2UKPj4KZW5kb2JqCjUgMCBvYmoKPDwKL091dGxpbmVzIDcgMCBSIC9QYWdlTW9kZSAvVXNlTm9uZSAvUGFnZXMgMTAgMCBSIC9UeXBlIC9DYXRhbG9nCj4+CmVuZG9iago2IDAgb2JqCjw8Ci9BdXRob3IgKCkgL0NyZWF0aW9uRGF0ZSAoRDoyMDI1MDkyOTA2NDM1NiswMCcwMCcpIC9DcmVhdG9yIChcKHVuc3BlY2lmaWVkXCkpIC9LZXl3b3JkcyAoKS


[on_tool_execution]
Tool: test
Outputs: {"type":"file","message":{},"meta":{"file":{"dify_model_identity":"__dify__file__","id":null,"tenant_id":"b7df5634-8029-4c6d-969f-c39e9f7ae646","type":"document","transfer_method":"tool_file","remote_url":null,"related_id":"daa5807b-bf1b-429b-a0c4-c792c2b43d45","filename":"15af481b86264b548b1a9e59a5248406.pdf","extension":".pdf","mime_type":"application/pdf","size":1954}}}

[on_tool_execution]
Tool: test
Outputs: {"type":"text","message":{"text":"{\"files1\": [{\"dify_model_identity\": \"__dify__file__\", \"id\": null, \"tenant_id\": \"b7df5634-8029-4c6d-969f-c39e9f7ae646\", \"type\": \"document\", \"transfer_method\": \"tool_file\", \"remote_url\": null, \"related_id\": \"daa5807b-bf1b-429b-a0c4-c792c2b43d45\", \"filename\": \"15af481b86264b548b1a9e59a5248406.pdf\", \"extension\": \".pdf\", \"mime_type\": \"application/pdf\", \"size\": 1954, \"url\": \"http://127.0.0.1:5001/files/tools/daa5807b-bf1b-429b-a0c4-c792c2b43d45.pdf?timestamp=1759128236&nonce=8b229fa50d6df2eb787765a40f502d99&sign=ymEk1BfpL3dDGOZPmtPYY0zYTUb_MJ-co3ZOcFclRs0=\", \"tool_file_id\": \"daa5807b-bf1b-429b-a0c4-c792c2b43d45\"}]}"},"meta":null}


[on_tool_execution]
Tool: test
Outputs: {"type":"json","message":{"json_object":{"files1":[{"dify_model_identity":"__dify__file__","id":null,"tenant_id":"b7df5634-8029-4c6d-969f-c39e9f7ae646","type":"document","transfer_method":"tool_file","remote_url":null,"related_id":"daa5807b-bf1b-429b-a0c4-c792c2b43d45","filename":"15af481b86264b548b1a9e59a5248406.pdf","extension":".pdf","mime_type":"application/pdf","size":1954,"url":"http://127.0.0.1:5001/files/tools/daa5807b-bf1b-429b-a0c4-c792c2b43d45.pdf?timestamp=1759128236&nonce=8b229fa50d6df2eb787765a40f502d99&sign=ymEk1BfpL3dDGOZPmtPYY0zYTUb_MJ-co3ZOcFclRs0=","tool_file_id":"daa5807b-bf1b-429b-a0c4-c792c2b43d45"}]}},"meta":null}

Actually, the tool of workflow as tool create file message correctly, but at last we got nothing at files field.

✔️ Expected Behavior

Workflow as tool files field return all files which this tool generated.

Actual Behavior

Workflow as tool files field return empty.

Here is relative issue: https://github.com/langgenius/dify/issues/18375

This issue mentioned pr https://github.com/langgenius/dify/pull/18427 is revertd by this pr https://github.com/langgenius/dify/pull/24061, because it introduce some new bug, but this behavior actually not correct, we need to fix it.

Thanks copilot agent, I found the problem maybe about this code:
https://github.com/langgenius/dify/blob/1a7898dff1a69791854a57d773520cb170e18bc6/api/core/tools/utils/message_transformer.py#L137-L157

The tool of workflow as tool return content relate message, and all workflow message will transform by message_transformer.py, at here it will transform file to link, and then when tool_node.py to handle message stream, it will goto message.type == ToolInvokeMessage.MessageType.LINK case, so that this tool files field return nothing.

Originally created by @CrabSAMA on GitHub (Sep 29, 2025). Originally assigned to: @CrabSAMA on GitHub. ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1. create a new workflow, add one generate file plugin, I use `md_exporter` <img width="1915" height="944" alt="Image" src="https://github.com/user-attachments/assets/f37a65ad-b0cd-4689-b2cd-a3e4ff4f0ed7" /> `md_exporter` tool `files` field have correct return 2. publish this workflow to tool 3. add this tool at another workflow and run it, watch the common tool field `files`, and it will found nothing <img width="1914" height="944" alt="Image" src="https://github.com/user-attachments/assets/30c7c0c9-77d7-48dd-921b-dce149804325" /> log here: ``` [on_tool_execution] Tool: md_to_pdf Outputs: {"type":"blob","message":{"blob":"JVBERi0xLjQKJZOMi54gUmVwb3J0TGFiIEdlbmVyYXRlZCBQREYgZG9jdW1lbnQgaHR0cDovL3d3dy5yZXBvcnRsYWIuY29tCjEgMCBvYmoKPDwKL0YxIDIgMCBSIC9GMiAzIDAgUgo+PgplbmRvYmoKMiAwIG9iago8PAovQmFzZUZvbnQgL0hlbHZldGljYSAvRW5jb2RpbmcgL1dpbkFuc2lFbmNvZGluZyAvTmFtZSAvRjEgL1N1YnR5cGUgL1R5cGUxIC9UeXBlIC9Gb250Cj4+CmVuZG9iagozIDAgb2JqCjw8Ci9CYXNlRm9udCAvSGVsdmV0aWNhLUJvbGQgL0VuY29kaW5nIC9XaW5BbnNpRW5jb2RpbmcgL05hbWUgL0YyIC9TdWJ0eXBlIC9UeXBlMSAvVHlwZSAvRm9udAo+PgplbmRvYmoKNCAwIG9iago8PAovQ29udGVudHMgMTEgMCBSIC9NZWRpYUJveCBbIDAgMCA1OTUuMjc1NiA4NDEuODg5OCBdIC9QYXJlbnQgMTAgMCBSIC9SZXNvdXJjZXMgPDwKL0ZvbnQgMSAwIFIgL1Byb2NTZXQgWyAvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJIF0KPj4gL1JvdGF0ZSAwIC9UcmFucyA8PAoKPj4gCiAgL1R5cGUgL1BhZ2UKPj4KZW5kb2JqCjUgMCBvYmoKPDwKL091dGxpbmVzIDcgMCBSIC9QYWdlTW9kZSAvVXNlTm9uZSAvUGFnZXMgMTAgMCBSIC9UeXBlIC9DYXRhbG9nCj4+CmVuZG9iago2IDAgb2JqCjw8Ci9BdXRob3IgKCkgL0NyZWF0aW9uRGF0ZSAoRDoyMDI1MDkyOTA2NDM1NiswMCcwMCcpIC9DcmVhdG9yIChcKHVuc3BlY2lmaWVkXCkpIC9LZXl3b3JkcyAoKS [on_tool_execution] Tool: test Outputs: {"type":"file","message":{},"meta":{"file":{"dify_model_identity":"__dify__file__","id":null,"tenant_id":"b7df5634-8029-4c6d-969f-c39e9f7ae646","type":"document","transfer_method":"tool_file","remote_url":null,"related_id":"daa5807b-bf1b-429b-a0c4-c792c2b43d45","filename":"15af481b86264b548b1a9e59a5248406.pdf","extension":".pdf","mime_type":"application/pdf","size":1954}}} [on_tool_execution] Tool: test Outputs: {"type":"text","message":{"text":"{\"files1\": [{\"dify_model_identity\": \"__dify__file__\", \"id\": null, \"tenant_id\": \"b7df5634-8029-4c6d-969f-c39e9f7ae646\", \"type\": \"document\", \"transfer_method\": \"tool_file\", \"remote_url\": null, \"related_id\": \"daa5807b-bf1b-429b-a0c4-c792c2b43d45\", \"filename\": \"15af481b86264b548b1a9e59a5248406.pdf\", \"extension\": \".pdf\", \"mime_type\": \"application/pdf\", \"size\": 1954, \"url\": \"http://127.0.0.1:5001/files/tools/daa5807b-bf1b-429b-a0c4-c792c2b43d45.pdf?timestamp=1759128236&nonce=8b229fa50d6df2eb787765a40f502d99&sign=ymEk1BfpL3dDGOZPmtPYY0zYTUb_MJ-co3ZOcFclRs0=\", \"tool_file_id\": \"daa5807b-bf1b-429b-a0c4-c792c2b43d45\"}]}"},"meta":null} [on_tool_execution] Tool: test Outputs: {"type":"json","message":{"json_object":{"files1":[{"dify_model_identity":"__dify__file__","id":null,"tenant_id":"b7df5634-8029-4c6d-969f-c39e9f7ae646","type":"document","transfer_method":"tool_file","remote_url":null,"related_id":"daa5807b-bf1b-429b-a0c4-c792c2b43d45","filename":"15af481b86264b548b1a9e59a5248406.pdf","extension":".pdf","mime_type":"application/pdf","size":1954,"url":"http://127.0.0.1:5001/files/tools/daa5807b-bf1b-429b-a0c4-c792c2b43d45.pdf?timestamp=1759128236&nonce=8b229fa50d6df2eb787765a40f502d99&sign=ymEk1BfpL3dDGOZPmtPYY0zYTUb_MJ-co3ZOcFclRs0=","tool_file_id":"daa5807b-bf1b-429b-a0c4-c792c2b43d45"}]}},"meta":null} ``` Actually, the tool of workflow as tool create file message correctly, but at last we got nothing at `files` field. ### ✔️ Expected Behavior Workflow as tool `files` field return all files which this tool generated. ### ❌ Actual Behavior Workflow as tool `files` field return empty. Here is relative issue: https://github.com/langgenius/dify/issues/18375 This issue mentioned pr https://github.com/langgenius/dify/pull/18427 is revertd by this pr https://github.com/langgenius/dify/pull/24061, because it introduce some new bug, but this behavior actually not correct, we need to fix it. Thanks copilot agent, I found the problem maybe about this code: https://github.com/langgenius/dify/blob/1a7898dff1a69791854a57d773520cb170e18bc6/api/core/tools/utils/message_transformer.py#L137-L157 The tool of workflow as tool return content relate message, and all workflow message will transform by `message_transformer.py`, at here it will transform file to link, and then when `tool_node.py` to handle message stream, it will goto `message.type == ToolInvokeMessage.MessageType.LINK` case, so that this tool `files` field return nothing.
yindo added the 🐞 bug label 2026-02-21 19:48:48 -05:00
yindo closed this issue 2026-02-21 19:48:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18532