Skip to content

When the agent calls the tool for workflow conversion, the tool returns the result twice, and the agent's final result is empty. #22972

Closed as not planned

Description

@Moiyu1998

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.7.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

The tool invocation process is shown in the figure above.

Image

When calling writeOverallLearningSummary, the tool converted by the workflow, the result was returned twice, and both results were exactly the same.

Image

Moreover, the final result returned by this agent is empty.

✔️ Expected Behavior

  1. When calling a tool converted by the workflow, it should not return the same result twice.
  2. After the agent successfully calls the tool, its final returned result should not be empty.

❌ Actual Behavior

No response

Activity

  1. added
    🤖 feat:agent
    on Jul 25, 2025
  2. Moiyu1998 commented on Jul 25, 2025

    @Moiyu1998
    Author

    I think this should be a bug. I have tried several times, and after calling the tool converted by the workflow, the agent stops working and does not produce a final result.

  3. dosubot commented on Jul 25, 2025

    @dosubot

    This is a known issue with workflow-converted tools in Dify. The root cause is that the workflow tool yields both a text and a JSON message for each invocation, which can result in duplicate outputs if both are processed or displayed without filtering. If the agent or downstream logic expects only one result or a specific format, this can also lead to empty outputs if the wrong message is selected or if the concatenated result isn't valid for further parsing. There isn't currently a mechanism to mark or select a canonical result from a tool call, which creates ambiguity when both formats are emitted for the same data [code reference].

    Recent fixes (like PR #22462, merged 2025-07-21) address related workflow tool issues, so upgrading to the latest Dify version may help if that's an option for you [issue reference]. If you can't upgrade, double-check that all required tool parameters are explicitly set in your workflow tool node configuration—missing or malformed parameters can also cause the agent to hang or return empty results.

    As a temporary workaround, you can filter or post-process the agent output to select only the desired result (either text or JSON). If the issue persists after these steps, sharing more details or logs could help further isolate the problem.

    To reply, just mention @dosu.


    How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

  4. Moiyu1998 commented on Jul 25, 2025

    @Moiyu1998
    Author
    Image

    It is obvious during the execution that this tool returns the result twice, and the results are identical.

    Image

    Each time after calling this tool, the process gets stuck. After waiting for a while, the agent stops running, but the final returned result is empty.

  5. Moiyu1998 commented on Jul 25, 2025

    @Moiyu1998
    Author

    I think the issue is that the tool returns the result twice, and the format is not standardized, which causes the agent to be unable to continue execution. Please fix this bug.

  6. EcoleKeine commented on Jul 31, 2025

    @EcoleKeine

    what is your LLM?
    some LLM will return empty if answer already responsed, in your case, answered by last tool call
    有些LLM 之前的回答已经解答的情况下会返回空,你的例子里就是最后一个工具调用的结果已经是答案了

    aslo check
    #18731

  7. haofengW commented on Aug 2, 2025

    @haofengW

    The version I'm using is 1.7.1, but this problem still persists.
    #19463 (comment)

  8. dosubot commented on Sep 2, 2025

    @dosubot

    Hi, @Moiyu1998. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

    Issue Summary:

    • You reported a bug in version 1.7.0 where a workflow-converted tool returns duplicate results, causing the agent to hang and produce an empty final output.
    • The issue is known to be caused by the tool emitting both text and JSON messages per call, leading to ambiguity and duplicate outputs.
    • Workarounds I suggested include upgrading to the latest version or filtering outputs manually.
    • You confirmed the problem persists with screenshots and urged for a fix.
    • Other users noted the issue continues in version 1.7.1 and discussed related behavior with certain LLMs.

    Next Steps:

    • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
    • If I don’t hear back within 15 days, I will automatically close this issue to help us focus on active concerns.

    Thank you for your understanding and contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤖 feat:agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions