Chatflow reports an error when calling tools using Agent node #15937

Closed
opened 2026-02-21 19:24:02 -05:00 by yindo · 1 comment
Owner

Originally created by @NieRonghua on GitHub (Aug 6, 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.7.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image This is the setup of my Agent node, which has 4 tools configured. The tools are all published through workflows. Image

Each tool is executed without any problems

Image

As you can see from the picture below, the Agent has called the tool, but reported an error:

Image

My Agent plugin version is 0.0.23

I checked the source code of the Agent plugin and it seems that this line of code is the error returned. However, the official python dify_plugin package is called here, and my package version is the latest version 0.4.3.

Image

✔️ Expected Behavior

What is the cause of this problem? I am proficient in using dify_plugin to develop plug-ins. I can develop on the current Agent source code, but I don’t know where to add logs for debugging. I hope to get a reply. Thank you.

Actual Behavior

No response

Originally created by @NieRonghua on GitHub (Aug 6, 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.7.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="393" height="624" alt="Image" src="https://github.com/user-attachments/assets/cb35bba8-3cf8-4e37-b325-93377579ee0d" /> This is the setup of my Agent node, which has 4 tools configured. The tools are all published through workflows. <img width="1871" height="502" alt="Image" src="https://github.com/user-attachments/assets/54253680-8d8d-44d7-bb09-7eae78143005" /> Each tool is executed without any problems <img width="1129" height="171" alt="Image" src="https://github.com/user-attachments/assets/73321410-e702-4962-881b-6afd419cdcd7" /> As you can see from the picture below, the Agent has called the tool, but reported an error: <img width="412" height="513" alt="Image" src="https://github.com/user-attachments/assets/20cd5470-3e89-4751-957a-af566716ec9a" /> My Agent plugin version is 0.0.23 <!-- Failed to upload "image.png" --> I checked the source code of the Agent plugin and it seems that this line of code is the error returned. However, the official python dify_plugin package is called here, and my package version is the latest version 0.4.3. <img width="861" height="584" alt="Image" src="https://github.com/user-attachments/assets/d22b8e58-976c-4385-8887-ef8d65ce47fe" /> ### ✔️ Expected Behavior What is the cause of this problem? I am proficient in using dify_plugin to develop plug-ins. I can develop on the current Agent source code, but I don’t know where to add logs for debugging. I hope to get a reply. Thank you. ### ❌ Actual Behavior _No response_
yindo added the 🤖 feat:agent label 2026-02-21 19:24:02 -05:00
yindo closed this issue 2026-02-21 19:24:02 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 6, 2025):

The most common root causes for Agent node tool invocation errors like this are: missing user/session context (e.g., an anonymous user object without a session_id), environment variable mismatches (especially PLUGIN_DIFY_INNER_API_KEY and SECRET_KEY across Docker services), and version incompatibilities between Dify, the Agent plugin, and dify_plugin example example.

For debugging, add logs in the Agent plugin source (especially in FunctionCallingAgentStrategy._invoke) at these points: after tool lookup, before/after calling self.session.tool.invoke(), and before dereferencing any value that could be None. Log the user/session object, tool metadata, plugin responses, and any error branches. For example:

logger.debug(f"Invoking tool: {tool}, user: {user}, session: {getattr(user, 'session_id', None)}")
try:
    result = self.session.tool.invoke(...)
    logger.debug(f"Tool result: {result}")
except Exception as e:
    logger.error(f"Tool invocation failed: {e}", exc_info=True)

If you are developing workflow tools, always ensure they return ToolInvokeMessage objects (never plain strings), even for errors. For example:

try:
    yield self.create_json_message(outputs)
except Exception as e:
    yield self.create_text_message(f"Error: {str(e)}")

reference

Check that all relevant environment variables are consistent and restart all Docker containers after changes reference. If you are on Dify 1.7.0, consider upgrading to the latest version—recent PRs improved version handling and error reporting for agent/tool nodes reference reference.

With the latest Dify, error messages for plugin/tool invocation failures are more detailed and will help you pinpoint the root cause faster.

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 (Aug 6, 2025): <!-- Answer --> The most common root causes for Agent node tool invocation errors like this are: missing user/session context (e.g., an anonymous user object without a `session_id`), environment variable mismatches (especially `PLUGIN_DIFY_INNER_API_KEY` and `SECRET_KEY` across Docker services), and version incompatibilities between Dify, the Agent plugin, and `dify_plugin` [example](https://github.com/langgenius/dify/issues/20166) [example](https://github.com/langgenius/dify/issues/22896). For debugging, add logs in the Agent plugin source (especially in `FunctionCallingAgentStrategy._invoke`) at these points: after tool lookup, before/after calling `self.session.tool.invoke()`, and before dereferencing any value that could be `None`. Log the user/session object, tool metadata, plugin responses, and any error branches. For example: ```python logger.debug(f"Invoking tool: {tool}, user: {user}, session: {getattr(user, 'session_id', None)}") try: result = self.session.tool.invoke(...) logger.debug(f"Tool result: {result}") except Exception as e: logger.error(f"Tool invocation failed: {e}", exc_info=True) ``` If you are developing workflow tools, always ensure they return `ToolInvokeMessage` objects (never plain strings), even for errors. For example: ```python try: yield self.create_json_message(outputs) except Exception as e: yield self.create_text_message(f"Error: {str(e)}") ``` [reference](https://github.com/langgenius/dify/issues/21227) Check that all relevant environment variables are consistent and restart all Docker containers after changes [reference](https://github.com/langgenius/dify/issues/20777). If you are on Dify 1.7.0, consider upgrading to the latest version—recent PRs improved version handling and error reporting for agent/tool nodes [reference](https://github.com/langgenius/dify/pull/22462) [reference](https://github.com/langgenius/dify/pull/22908). With the latest Dify, error messages for plugin/tool invocation failures are more detailed and will help you pinpoint the root cause faster. <!-- 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/0e3f068c-3087-421e-9d4f-5e82355407c1?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0e3f068c-3087-421e-9d4f-5e82355407c1?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0e3f068c-3087-421e-9d4f-5e82355407c1?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0e3f068c-3087-421e-9d4f-5e82355407c1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0e3f068c-3087-421e-9d4f-5e82355407c1?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0e3f068c-3087-421e-9d4f-5e82355407c1?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0e3f068c-3087-421e-9d4f-5e82355407c1?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/23503)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15937