If the response from the agent when calling a tool is a JSON object, the returned JSON will be repeated twice. #20204

Closed
opened 2026-02-21 20:06:17 -05:00 by yindo · 3 comments
Owner

Originally created by @fsea on GitHub (Nov 7, 2025).

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

Self Hosted (Docker)

Steps to reproduce

Agent calls tools,
The tool returns a JSON object.

Image

The JSON obtained when calling the tool separately is as follows:
Image

✔️ Expected Behavior

Duplicate JSON

Actual Behavior

Return the result of the callback tool without processing

Originally created by @fsea on GitHub (Nov 7, 2025). ### 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.8.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Agent calls tools, The tool returns a JSON object. <img width="1438" height="1745" alt="Image" src="https://github.com/user-attachments/assets/6fbe3a6b-63b1-4805-bb42-352078602184" /> The JSON obtained when calling the tool separately is as follows: <img width="1890" height="1282" alt="Image" src="https://github.com/user-attachments/assets/b0aa78e3-79d8-4a1b-ab79-9b43ba0eccf8" /> ### ✔️ Expected Behavior Duplicate JSON ### ❌ Actual Behavior Return the result of the callback tool without processing
yindo added the 🐞 bugstale labels 2026-02-21 20:06:17 -05:00
yindo closed this issue 2026-02-21 20:06:17 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 7, 2025):

This duplication issue with agent tool JSON responses was recently fixed in the Dify codebase. The bug caused the agent to output the workflow-tool response twice, including JSON objects. The fix refactored the tool response handling to properly separate and concatenate text and JSON parts, ensuring no duplicate output. These changes were merged after version 1.8.1, so you'll need to update to a newer version to get the fix. You can review the details and code changes in the merged pull requests: PR #27706 and PR #27087.

To reply, just mention @dosu.


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

@dosubot[bot] commented on GitHub (Nov 7, 2025): <!-- Answer --> This duplication issue with agent tool JSON responses was recently fixed in the Dify codebase. The bug caused the agent to output the workflow-tool response twice, including JSON objects. The fix refactored the tool response handling to properly separate and concatenate text and JSON parts, ensuring no duplicate output. These changes were merged after version 1.8.1, so you'll need to update to a newer version to get the fix. You can review the details and code changes in the merged pull requests: [PR #27706](https://github.com/langgenius/dify/pull/27706) and [PR #27087](https://github.com/langgenius/dify/pull/27087). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/9eb0867c-171f-49b0-8a09-63d487217a84?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/9eb0867c-171f-49b0-8a09-63d487217a84?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/9eb0867c-171f-49b0-8a09-63d487217a84?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/9eb0867c-171f-49b0-8a09-63d487217a84?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9eb0867c-171f-49b0-8a09-63d487217a84?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/9eb0867c-171f-49b0-8a09-63d487217a84?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/9eb0867c-171f-49b0-8a09-63d487217a84?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/27986)
Author
Owner

@fsea commented on GitHub (Nov 10, 2025):

@dosubot
Image
The problem still exists after upgrading to 1.9.2.

@fsea commented on GitHub (Nov 10, 2025): @dosubot <img width="1223" height="1212" alt="Image" src="https://github.com/user-attachments/assets/cb8f31cd-fa1f-4fe7-9499-75cd78900171" /> The problem still exists after upgrading to 1.9.2.
Author
Owner

@dosubot[bot] commented on GitHub (Nov 10, 2025):

The fix for duplicate or unprocessed JSON responses from agent tool calls was merged after the release of version 1.9.2, so it's not included in your current version. To resolve this, you'll need to upgrade to a newer Dify release where the fix is present—see PR #27706 and PR #27087 for details. If you can't upgrade right away, you can try to patch your deployment by backporting the changes from those pull requests.

To reply, just mention @dosu.


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

@dosubot[bot] commented on GitHub (Nov 10, 2025): <!-- Answer --> The fix for duplicate or unprocessed JSON responses from agent tool calls was merged after the release of version 1.9.2, so it's not included in your current version. To resolve this, you'll need to upgrade to a newer Dify release where the fix is present—see [PR #27706](https://github.com/langgenius/dify/pull/27706) and [PR #27087](https://github.com/langgenius/dify/pull/27087) for details. If you can't upgrade right away, you can try to patch your deployment by backporting the changes from those pull requests. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d85161a8-6deb-4757-a30b-2c30b87a8d8e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d85161a8-6deb-4757-a30b-2c30b87a8d8e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d85161a8-6deb-4757-a30b-2c30b87a8d8e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d85161a8-6deb-4757-a30b-2c30b87a8d8e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d85161a8-6deb-4757-a30b-2c30b87a8d8e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d85161a8-6deb-4757-a30b-2c30b87a8d8e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d85161a8-6deb-4757-a30b-2c30b87a8d8e?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/27986)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20204