Agent UI incorrectly displays duplicate tool calls (only shows the second invocation) #21774

Open
opened 2026-02-21 20:14:14 -05:00 by yindo · 1 comment
Owner

Originally created by @seanchen0123 on GitHub (Jan 19, 2026).

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

Cloud or Self Hosted

Cloud

Steps to reproduce

When using an Agent application with a callable tool, if the same tool is invoked twice within a single agent run, the UI does not display the tool calls correctly.Although the final answer indicates that both tool calls were executed successfully, the UI and network events only expose the second invocation, which makes debugging and reasoning about the agent’s behavior very difficult.

  1. Create an Agent application in Dify.
  2. Attach any executable tool (the specific tool does not matter).
  3. Ask a question that causes the agent to invoke the same tool twice during its reasoning process.
Image Image Image

✔️ Expected Behavior

  • Each tool invocation should be displayed separately in the UI.
  • Expanding a tool call should show the correct input and output for each invocation.
  • The agent_thought events in the Network panel should contain records for both tool calls.

Actual Behavior

  • The UI merges the two tool calls into one entry.
  • When expanding the tool call, only the second invocation’s input and output are shown.
  • In the browser Network panel, the agent_thought event only contains the second tool call record.
  • However, based on the final agent response, the first tool call appears to have executed successfully.
Originally created by @seanchen0123 on GitHub (Jan 19, 2026). ### 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.11.4 ### Cloud or Self Hosted Cloud ### Steps to reproduce When using an **Agent application** with a callable tool, if the same tool is invoked **twice within a single agent run**, the UI does not display the tool calls correctly.Although the final answer indicates that **both tool calls were executed successfully**, the UI and network events only expose the **second invocation**, which makes debugging and reasoning about the agent’s behavior very difficult. 1. Create an **Agent application** in Dify. 2. Attach **any executable tool** (the specific tool does not matter). 3. Ask a question that causes the agent to **invoke the same tool twice** during its reasoning process. <img width="1011" height="877" alt="Image" src="https://github.com/user-attachments/assets/50df1bd8-2b2c-449f-8784-bddfcfa2df17" /> <img width="955" height="799" alt="Image" src="https://github.com/user-attachments/assets/adfcceb8-8fc4-4bc7-b80e-aa311319893e" /> <img width="737" height="312" alt="Image" src="https://github.com/user-attachments/assets/18ddedc8-689b-41d3-b807-6bde3958df1a" /> ### ✔️ Expected Behavior * Each tool invocation should be displayed **separately** in the UI. * Expanding a tool call should show the **correct input and output for each invocation**. * The `agent_thought` events in the Network panel should contain **records for both tool calls**. ### ❌ Actual Behavior * The UI **merges the two tool calls into one entry**. * When expanding the tool call, **only the second invocation’s input and output are shown**. * In the browser Network panel, the `agent_thought` event **only contains the second tool call record**. * However, based on the **final agent response**, the first tool call appears to have executed successfully.
yindo added the 🐞 bug🤖 feat:agentstale labels 2026-02-21 20:14:14 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 19, 2026):

This is a known bug in Dify v1.11.4: when the same tool is invoked multiple times in a single agent run, the UI and network logs only show the last invocation, merging both calls into one entry. This affects all tools and makes debugging difficult. The issue is tracked in #31247 and confirmed in other reports (#21948, #12260).

The root cause is that the backend emits multiple tool calls under the same message_id, and the frontend groups log entries by this ID—so only the last call's data is displayed, overwriting earlier calls. Tool responses are also stored in a dictionary keyed by tool name, so repeated calls overwrite previous results instead of preserving all invocations. Fixing this requires the backend to assign a unique identifier to each tool call and aggregate responses per call (for example, by tool_call_id or as a list), so the UI can display each invocation separately (source).

There is no official workaround yet. If you need to debug agent behavior, you can inspect server logs for all tool invocations, or design your agent prompt to avoid repeated calls to the same tool until a fix is released. If you want to track progress or contribute, see the backend logic in api/core/agent/base_agent_runner.py and the frontend rendering in web/app/components/workflow/run/agent-log/agent-result-panel.tsx.

Let me know if you need more technical details or want to discuss possible code-level workarounds.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 19, 2026): <!-- Answer --> This is a known bug in Dify v1.11.4: when the same tool is invoked multiple times in a single agent run, the UI and network logs only show the last invocation, merging both calls into one entry. This affects all tools and makes debugging difficult. The issue is tracked in [#31247](https://github.com/langgenius/dify/issues/31247) and confirmed in other reports ([#21948](https://github.com/langgenius/dify/issues/21948), [#12260](https://github.com/langgenius/dify/issues/12260)). The root cause is that the backend emits multiple tool calls under the same `message_id`, and the frontend groups log entries by this ID—so only the last call's data is displayed, overwriting earlier calls. Tool responses are also stored in a dictionary keyed by tool name, so repeated calls overwrite previous results instead of preserving all invocations. Fixing this requires the backend to assign a unique identifier to each tool call and aggregate responses per call (for example, by `tool_call_id` or as a list), so the UI can display each invocation separately ([source](https://github.com/langgenius/dify/pull/27749)). There is no official workaround yet. If you need to debug agent behavior, you can inspect server logs for all tool invocations, or design your agent prompt to avoid repeated calls to the same tool until a fix is released. If you want to track progress or contribute, see the backend logic in [`api/core/agent/base_agent_runner.py`](https://github.com/langgenius/dify/pull/27749) and the frontend rendering in [`web/app/components/workflow/run/agent-log/agent-result-panel.tsx`](https://github.com/langgenius/dify/blob/62ac02a5680af5276bf65cc5a7f64fa172994990/web/app/components/workflow/run/agent-log/agent-result-panel.tsx). Let me know if you need more technical details or want to discuss possible code-level workarounds. <!-- 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/be2d0df2-a988-4f3c-a93d-c0e78ef4a904?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/be2d0df2-a988-4f3c-a93d-c0e78ef4a904?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/be2d0df2-a988-4f3c-a93d-c0e78ef4a904?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/be2d0df2-a988-4f3c-a93d-c0e78ef4a904?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/be2d0df2-a988-4f3c-a93d-c0e78ef4a904?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/be2d0df2-a988-4f3c-a93d-c0e78ef4a904?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/be2d0df2-a988-4f3c-a93d-c0e78ef4a904?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20bug%20in%20Dify%20v1.11.4%3A%20when%20the%20same%20tool%20is%20invoked%20multiple%20times%20in%20a%20single%20agent%20run%2C%20the%20UI%20and%20network%20logs%20only%20show%20the%20last%20invocation%2C%20merging%20both%20calls%20into%20one%20entry.%20This%20affects%20all%20tools%20and%20makes%20debugging%20difficult.%20The%20issue%20is%20tracked%20in%20%5B%2331247%5D%28https%3A//github.com/langgenius/dify/issues/31247%29%20and%20confirmed%20in%20other%20reports%20%28%5B%2321948%5D%28https%3A//github.com/langgenius/dify/issues/21948%29%2C%20%5B%2312260%5D%28https%3A//github.com/langgenius/dify/issues/12260%29%29.%0A%0AThe%20root%20cause%20is%20that%20the%20backend%20emits%20multiple%20tool%20calls%20under%20the%20same%20%60message_id%60%2C%20and%20the%20frontend%20groups%20log%20entries%20by%20this%20ID%E2%80%94so%20only%20the%20last%20call%27s%20data%20is%20displayed%2C%20overwriting%20earlier%20calls.%20Tool%20responses%20are%20also%20stored%20in%20a%20dictionary%20keyed%20by%20tool%20name%2C%20so%20repeated%20calls%20overwrite%20previous%20results%20instead%20of%20preserving%20all%20invocations.%20Fixing%20this%20requires%20the%20backend%20to%20assign%20a%20unique%20identifier%20to%20each%20tool%20call%20and%20aggregate%20responses%20per%20call%20%28for%20example%2C%20by%20%60tool_call_id%60%20or%20as%20a%20list%29%2C%20so%20the%20UI%20can%20display%20each%20invocation%20separately%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/pull/27749%29%29.%0A%0AThere%20is%20no%20official%20workaround%20yet.%20If%20you%20need%20to%20debug%20agent%20behavior%2C%20you%20can%20inspect%20server%20logs%20for%20all%20tool%20invocations%2C%20or%20design%20your%20agent%20prompt%20to%20avoid%20repeated%20calls%20to%20the%20same%20tool%20until%20a%20fix%20is%20released.%20If%20you%20want%20to%20track%20progress%20or%20contribute%2C%20see%20the%20backend%20logic%20in%20%5B%60api/core/agent/base_agent_runner.py%60%5D%28https%3A//github.com/langgenius/dify/pull/27749%29%20and%20the%20frontend%20rendering%20in%20%5B%60web/app/components/workflow/run/agent-log/agent-result-panel.tsx%60%5D%28https%3A//github.com/langgenius/dify/blob/62ac02a5680af5276bf65cc5a7f64fa172994990/web/app/components/workflow/run/agent-log/agent-result-panel.tsx%29.%0A%0ALet%20me%20know%20if%20you%20need%20more%20technical%20details%20or%20want%20to%20discuss%20possible%20code-level%20workarounds.)&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/31247)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21774