An error occurred when calling the knowledge base while using the agent #21605

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

Originally created by @Eavinn on GitHub (Jan 13, 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.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. The agent adds a knowledge base and incorporates automatic filtering
  2. When the agent calls the knowledge base, if no matching result is found, an error will be reported
Image

✔️ Expected Behavior

Skip the empty parts returned by the knowledge base and output the normal query results

Actual Behavior

No response

Originally created by @Eavinn on GitHub (Jan 13, 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.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. The agent adds a knowledge base and incorporates automatic filtering 2. When the agent calls the knowledge base, if no matching result is found, an error will be reported <img width="1852" height="910" alt="Image" src="https://github.com/user-attachments/assets/9ea1e6b8-1a27-44f0-8d74-bfae37203cff" /> ### ✔️ Expected Behavior Skip the empty parts returned by the knowledge base and output the normal query results ### ❌ Actual Behavior _No response_
yindo added the 🐞 bugstale labels 2026-02-21 20:13:27 -05:00
Author
Owner

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

Hi @Eavinn! I'm Dosu and I’m helping the dify team.

The error happens because when the knowledge base returns no results, the agent's tool call message formatting doesn't match what the LLM API expects—specifically, "tool_calls" must be followed by tool messages with the correct "tool_call_id". This is a known issue with parallel tool calls and empty responses in Dify agent workflows. The backend code actually returns an empty result (not an error), but the agent/plugin layer mishandles the empty response, causing the protocol error you see in the UI.

This has been fixed in the dify-official-plugins repo: upgrading your plugin/strategy version to 0.0.29 or later will resolve the error by merging all tool calls into a single assistant message and ensuring correct sequencing of tool call responses. If you can't upgrade right away, a temporary workaround is to avoid parallel tool calls in your workflow and serialize them instead. More details and the fix are described here: dify-official-plugins PR #2351 and discussion of the error.

If you use custom plugins or models, also check for output handling quirks and consider adding retry logic or tuning error handling modes (like CONTINUE_ON_ERROR) to avoid halting on empty outputs.

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 13, 2026): <!-- Greeting --> Hi @Eavinn! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> The error happens because when the knowledge base returns no results, the agent's tool call message formatting doesn't match what the LLM API expects—specifically, "tool_calls" must be followed by tool messages with the correct "tool_call_id". This is a known issue with parallel tool calls and empty responses in Dify agent workflows. The backend code actually returns an empty result (not an error), but the agent/plugin layer mishandles the empty response, causing the protocol error you see in the UI. This has been fixed in the dify-official-plugins repo: upgrading your plugin/strategy version to 0.0.29 or later will resolve the error by merging all tool calls into a single assistant message and ensuring correct sequencing of tool call responses. If you can't upgrade right away, a temporary workaround is to avoid parallel tool calls in your workflow and serialize them instead. More details and the fix are described here: [dify-official-plugins PR #2351](https://github.com/langgenius/dify-official-plugins/pull/2351) and [discussion of the error](https://github.com/langgenius/dify-official-plugins/issues/2352). If you use custom plugins or models, also check for output handling quirks and consider adding retry logic or tuning error handling modes (like CONTINUE_ON_ERROR) to avoid halting on empty outputs. <!-- 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/55a8d5e2-8d0a-4c83-b8f0-63f0f0e2fb28?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/55a8d5e2-8d0a-4c83-b8f0-63f0f0e2fb28?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/55a8d5e2-8d0a-4c83-b8f0-63f0f0e2fb28?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/55a8d5e2-8d0a-4c83-b8f0-63f0f0e2fb28?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/55a8d5e2-8d0a-4c83-b8f0-63f0f0e2fb28?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/55a8d5e2-8d0a-4c83-b8f0-63f0f0e2fb28?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/55a8d5e2-8d0a-4c83-b8f0-63f0f0e2fb28?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=The%20error%20happens%20because%20when%20the%20knowledge%20base%20returns%20no%20results%2C%20the%20agent%27s%20tool%20call%20message%20formatting%20doesn%27t%20match%20what%20the%20LLM%20API%20expects%E2%80%94specifically%2C%20%22tool_calls%22%20must%20be%20followed%20by%20tool%20messages%20with%20the%20correct%20%22tool_call_id%22.%20This%20is%20a%20known%20issue%20with%20parallel%20tool%20calls%20and%20empty%20responses%20in%20Dify%20agent%20workflows.%20The%20backend%20code%20actually%20returns%20an%20empty%20result%20%28not%20an%20error%29%2C%20but%20the%20agent/plugin%20layer%20mishandles%20the%20empty%20response%2C%20causing%20the%20protocol%20error%20you%20see%20in%20the%20UI.%0A%0AThis%20has%20been%20fixed%20in%20the%20dify-official-plugins%20repo%3A%20upgrading%20your%20plugin/strategy%20version%20to%200.0.29%20or%20later%20will%20resolve%20the%20error%20by%20merging%20all%20tool%20calls%20into%20a%20single%20assistant%20message%20and%20ensuring%20correct%20sequencing%20of%20tool%20call%20responses.%20If%20you%20can%27t%20upgrade%20right%20away%2C%20a%20temporary%20workaround%20is%20to%20avoid%20parallel%20tool%20calls%20in%20your%20workflow%20and%20serialize%20them%20instead.%20More%20details%20and%20the%20fix%20are%20described%20here%3A%20%5Bdify-official-plugins%20PR%20%232351%5D%28https%3A//github.com/langgenius/dify-official-plugins/pull/2351%29%20and%20%5Bdiscussion%20of%20the%20error%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2352%29.%0A%0AIf%20you%20use%20custom%20plugins%20or%20models%2C%20also%20check%20for%20output%20handling%20quirks%20and%20consider%20adding%20retry%20logic%20or%20tuning%20error%20handling%20modes%20%28like%20CONTINUE_ON_ERROR%29%20to%20avoid%20halting%20on%20empty%20outputs.)&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/30905)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21605