When calling a tool, if the tool itself requests an error, the program will report an error #7494

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

Originally created by @jlokys on GitHub (Jan 2, 2025).

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.14.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

When calling a tool, if the tool itself requests an error, the program will report an error

image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @jlokys on GitHub (Jan 2, 2025). ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.14.2 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce When calling a tool, if the tool itself requests an error, the program will report an error ![image](https://github.com/user-attachments/assets/588fd061-4f5a-436e-b541-4be3b7a2ff68) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🌚 invalid label 2026-02-21 18:20:53 -05:00
yindo closed this issue 2026-02-21 18:20:53 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 2, 2025):

To resolve the AttributeError indicating that ToolEngineInvokeError has no attribute meta, ensure that when you are raising the ToolEngineInvokeError, you are passing the meta argument correctly. The ToolEngineInvokeError class is defined to accept a meta parameter in its constructor, which is then assigned to the instance attribute self.meta.

Here's an example of how you should raise this error:

from core.tools.errors import ToolEngineInvokeError
from core.tools.entities.tool_entities import ToolInvokeMeta

# Assuming you have a ToolInvokeMeta instance
meta_instance = ToolInvokeMeta(...)

try:
    # Some code that might fail
    pass
except SomeException as e:
    raise ToolEngineInvokeError(meta=meta_instance) from e

Ensure that ToolInvokeMeta is correctly imported and instantiated before passing it to ToolEngineInvokeError. If meta is not provided or incorrectly passed, it will result in an AttributeError [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 2, 2025): <!-- Answer --> To resolve the `AttributeError` indicating that `ToolEngineInvokeError` has no attribute `meta`, ensure that when you are raising the `ToolEngineInvokeError`, you are passing the `meta` argument correctly. The `ToolEngineInvokeError` class is defined to accept a `meta` parameter in its constructor, which is then assigned to the instance attribute `self.meta`. Here's an example of how you should raise this error: ```python from core.tools.errors import ToolEngineInvokeError from core.tools.entities.tool_entities import ToolInvokeMeta # Assuming you have a ToolInvokeMeta instance meta_instance = ToolInvokeMeta(...) try: # Some code that might fail pass except SomeException as e: raise ToolEngineInvokeError(meta=meta_instance) from e ``` Ensure that `ToolInvokeMeta` is correctly imported and instantiated before passing it to `ToolEngineInvokeError`. If `meta` is not provided or incorrectly passed, it will result in an `AttributeError` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/tools/errors.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/c3de8594-b1c6-4118-afae-7f7fc4a4638b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/c3de8594-b1c6-4118-afae-7f7fc4a4638b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/c3de8594-b1c6-4118-afae-7f7fc4a4638b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/c3de8594-b1c6-4118-afae-7f7fc4a4638b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c3de8594-b1c6-4118-afae-7f7fc4a4638b?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/c3de8594-b1c6-4118-afae-7f7fc4a4638b?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Jan 2, 2025):

What's your expected behavior? I am not quite understand what you are trying to make here.
If you get an error, and the program report an error, I figure this is expected right?

@crazywoola commented on GitHub (Jan 2, 2025): What's your expected behavior? I am not quite understand what you are trying to make here. If you get an error, and the program report an error, I figure this is expected right?
Author
Owner

@jlokys commented on GitHub (Jan 2, 2025):

@crazywoola
There is a problem with the tool call request. The program will be handed over to the big model to continue executing. Now, running e.meta will display an error: AttributeError: 'ToolEngineInvokeError' object has no attribute 'meta', causing the program to not run further.

@jlokys commented on GitHub (Jan 2, 2025): @crazywoola There is a problem with the tool call request. The program will be handed over to the big model to continue executing. Now, running e.meta will display an error: AttributeError: 'ToolEngineInvokeError' object has no attribute 'meta', causing the program to not run further.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7494