Repository navigation
Description
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.8.1
Cloud or Self Hosted
Cloud
Steps to reproduce
When I publish a workflow as a tool and invoke it via the agent, the tool's output is returned twice.
Example:
请求
{"get_filtered_anomalous_transactions2": {"question": "时间范围: 2024年4月, 交易主体: 全部, 异常类型: 背靠背交易, 金额范围: 不限"}}
响应
{"get_filtered_anomalous_transactions2": "
{"reports": [{"支出二级单位简称": "1", "支出单位名称": "2", "支出本方账户": "3", "支出对方账户": "4"}]}
{"reports": [{"支出二级单位简称": "1", "支出单位名称": "2", "支出本方账户": "3", "支出对方账户": "4"}]}
"}
Steps to reproduce:
- Publish a workflow as a tool.
- Call the tool via the agent.
- Observe that the results are duplicated in the agent's response.
Expected behavior:
The tool should return the results only once.
Actual behavior:
The agent returns the same result twice.
Notes:
- This occurs consistently for all workflows published as tools.
- The duplication seems to happen on the agent side, not within the workflow itself.
✔️ Expected Behavior
请求
{"get_filtered_anomalous_transactions2": {"question": "时间范围: 2024年4月, 交易主体: 全部, 异常类型: 背靠背交易, 金额范围: 不限"}}
响应
{"get_filtered_anomalous_transactions2": "
{"reports": [{"支出二级单位简称": "1", "支出单位名称": "2", "支出本方账户": "3", "支出对方账户": "4"}]}“
❌ Actual Behavior
{"get_filtered_anomalous_transactions2": {"question": "时间范围: 2024年4月, 交易主体: 全部, 异常类型: 背靠背交易, 金额范围: 不限"}}
响应
{"get_filtered_anomalous_transactions2": "
{"reports": [{"支出二级单位简称": "1", "支出单位名称": "2", "支出本方账户": "3", "支出对方账户": "4"}]}
{"reports": [{"支出二级单位简称": "1", "支出单位名称": "2", "支出本方账户": "3", "支出对方账户": "4"}]}
"}
Activity
dosubot commentedon Apr 8, 2026
Hi @AiFu-o! I'm Dosu and I’m helping the dify team.
This is a known bug that has been reported multiple times [1] [2] [3] [4]. The root cause is that
WorkflowTool._invoke()yields both a TEXT message and a JSON message for the same output [5]:When the agent processes these, both representations end up in the final response, causing the duplication.
Fixes were merged after v1.8.1 — specifically PR #27087 (added a
suppress_outputflag on JSON messages) and PR #27706 (set-based deduplication in the response converter). Since you're on v1.8.1, these fixes are not included.Upgrading to a newer version should resolve or significantly reduce this issue. That said, some users have reported edge cases where duplication still occurs in later versions [6] [4].
As a workaround until you can upgrade, you could post-process the agent output to filter duplicates, or patch
WorkflowTool._invoke()locally to yield only the JSON message [7].To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
AiFu-o commentedon Apr 9, 2026
After updating, I encountered another issue. The parameters are no longer in a valid JSON format, and the duplication problem still persists.
Example:
请求
{"get_filtered_anomalous_transactions2": {"question": "时间范围: 2024年4月, 交易主体: 全部, 异常类型: 背靠背交易, 金额范围: 不限"}}
响应
{"get_filtered_anomalous_transactions_demo": "variable_name='reports' variable_value='
[{"支出二级单位简称": "1", "支出单位名称": "2", "支出本方账户": "3", "支出对方账户": "4"}]}
stream=False{"reports": "[{\"支出二级单位简称\": \"1\", \"支出单位名称\": \"2\", \"支出本方账户\": \"3\", \"支出对方账户\": \"4\"}]"}"}
AiFu-o commentedon Apr 9, 2026
version 1.13.3