Error on tool page #8747

Closed
opened 2026-02-21 18:27:23 -05:00 by yindo · 1 comment
Owner

Originally created by @djav1985 on GitHub (Feb 28, 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

1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When i goto tool page in i get server error:

     ^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
resp = meth(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 147, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/libs/login.py", line 94, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 27, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/workspace/tool_providers.py", line 44, in get
return ToolCommonService.list_tool_providers(user_id, tenant_id, args.get("type", None))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/services/tools/tools_manage_service.py", line 18, in list_tool_providers
providers = ToolManager.list_providers_from_api(user_id, tenant_id, typ)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/tools/tool_manager.py", line 596, in list_providers_from_api
if is_filtered(
^^^^^^^^^^^^
File "/app/api/core/helper/position_helper.py", line 95, in is_filtered
name = name_func(data)
^^^^^^^^^^^^^^^
File "/app/api/core/tools/tool_manager.py", line 600, in
name_func=lambda x: x.identity.name,
^^^^^^^^^^
AttributeError: 'CodeToolProvider' object has no attribute 'identity'. Did you mean: 'entity'?

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @djav1985 on GitHub (Feb 28, 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 1.0.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When i goto tool page in i get server error: ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 147, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 94, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 27, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/workspace/tool_providers.py", line 44, in get return ToolCommonService.list_tool_providers(user_id, tenant_id, args.get("type", None)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/tools/tools_manage_service.py", line 18, in list_tool_providers providers = ToolManager.list_providers_from_api(user_id, tenant_id, typ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 596, in list_providers_from_api if is_filtered( ^^^^^^^^^^^^ File "/app/api/core/helper/position_helper.py", line 95, in is_filtered name = name_func(data) ^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 600, in <lambda> name_func=lambda x: x.identity.name, ^^^^^^^^^^ AttributeError: 'CodeToolProvider' object has no attribute 'identity'. Did you mean: 'entity'? ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:27:23 -05:00
yindo closed this issue 2026-02-21 18:27:23 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 28, 2025):

The error you're encountering is due to the use of the identity attribute, which does not exist in the CodeToolProvider object. Instead, you should use the entity attribute. The entity attribute is used to store an instance of ToolProviderEntity, which provides access to the credentials schema and identity of the tool provider [1].

To resolve this issue, you should replace any references to identity with entity in the relevant parts of your code, specifically in the lambda function within the list_providers_from_api method. Here's a quick example of how you might adjust the lambda function:

name_func=lambda x: x.entity.name

This change should help you avoid the AttributeError and allow the code to function as expected.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Feb 28, 2025): <!-- Answer --> The error you're encountering is due to the use of the `identity` attribute, which does not exist in the `CodeToolProvider` object. Instead, you should use the `entity` attribute. The `entity` attribute is used to store an instance of `ToolProviderEntity`, which provides access to the credentials schema and identity of the tool provider <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/tools/__base/tool_provider.py)</sup>. To resolve this issue, you should replace any references to `identity` with `entity` in the relevant parts of your code, specifically in the lambda function within the `list_providers_from_api` method. Here's a quick example of how you might adjust the lambda function: ```python name_func=lambda x: x.entity.name ``` This change should help you avoid the `AttributeError` and allow the code to function as expected. <!-- 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/b0f9257d-d73a-481f-a7bb-abb8a2d5cc3e?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b0f9257d-d73a-481f-a7bb-abb8a2d5cc3e?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b0f9257d-d73a-481f-a7bb-abb8a2d5cc3e?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b0f9257d-d73a-481f-a7bb-abb8a2d5cc3e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b0f9257d-d73a-481f-a7bb-abb8a2d5cc3e?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/b0f9257d-d73a-481f-a7bb-abb8a2d5cc3e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b0f9257d-d73a-481f-a7bb-abb8a2d5cc3e?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8747