The query statement of the plugin is incorrect #80

Closed
opened 2026-02-16 00:19:39 -05:00 by yindo · 4 comments
Owner

Originally created by @309299817 on GitHub (Apr 8, 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.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

The plugin I uploaded locally
In the database, its plugin_i='weiheng/office_tools'
But in the plugin_daemon service, the SQL statements executed are: SELECT * FROM "tool_installations" WHERE tenant_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e' AND plugin_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e/office_tools' ORDER BY "tool_installations"."id" LIMIT 1
The composition of plugin_i is tenant+tool name.

Image

Image

✔️ Expected Behavior

SELECT * FROM "tool_installations" WHERE tenant_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e' AND plugin_id = 'weiheng/office_tools' ORDER BY "tool_installations"."id" LIMIT 1

Actual Behavior

SELECT * FROM "tool_installations" WHERE tenant_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e' AND plugin_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e/office_tools' ORDER BY "tool_installations"."id" LIMIT 1

Originally created by @309299817 on GitHub (Apr 8, 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.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce The plugin I uploaded locally In the database, its plugin_i='weiheng/office_tools' But in the plugin_daemon service, the SQL statements executed are: SELECT * FROM "tool_installations" WHERE tenant_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e' AND plugin_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e/office_tools' ORDER BY "tool_installations"."id" LIMIT 1 The composition of plugin_i is tenant+tool name. ![Image](https://github.com/user-attachments/assets/7ac46890-f676-415c-a8c1-7a1ac333a6b7) ![Image](https://github.com/user-attachments/assets/e86a1ef2-8aa5-4a3b-98b1-08c1f8b2bfa1) ### ✔️ Expected Behavior SELECT * FROM "tool_installations" WHERE tenant_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e' AND plugin_id = 'weiheng/office_tools' ORDER BY "tool_installations"."id" LIMIT 1 ### ❌ Actual Behavior SELECT * FROM "tool_installations" WHERE tenant_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e' AND plugin_id = '0b295234-a27a-4dc2-8e13-8d1441444e0e/office_tools' ORDER BY "tool_installations"."id" LIMIT 1
yindo closed this issue 2026-02-16 00:19:39 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 8, 2025):

The issue you're encountering seems to be related to a mismatch in the format of the plugin_id used in the SQL query versus the format stored in the database. According to the Dify codebase, the expected format of plugin_id in the database is "$organization/$plugin_name/$provider_name", but when used in query execution, the format is "$organization/$plugin_name" [1].

In your case, the plugin_id in the database is "weiheng/office_tools", but the query is using "0b295234-a27a-4dc2-8e13-8d1441444e0e/office_tools", which includes the tenant ID as part of the plugin_id. This discrepancy is likely causing the query to return no results.

To resolve this, you should ensure that the plugin_id used in the query matches the format stored in the database. You may need to adjust the logic in the plugin_daemon service or wherever the query is constructed to use the correct plugin_id format.

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 (Apr 8, 2025): <!-- Answer --> The issue you're encountering seems to be related to a mismatch in the format of the `plugin_id` used in the SQL query versus the format stored in the database. According to the Dify codebase, the expected format of `plugin_id` in the database is "$organization/$plugin_name/$provider_name", but when used in query execution, the format is "$organization/$plugin_name" <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/plugin/entities/plugin.py)</sup>. In your case, the `plugin_id` in the database is "weiheng/office_tools", but the query is using "0b295234-a27a-4dc2-8e13-8d1441444e0e/office_tools", which includes the tenant ID as part of the `plugin_id`. This discrepancy is likely causing the query to return no results. To resolve this, you should ensure that the `plugin_id` used in the query matches the format stored in the database. You may need to adjust the logic in the `plugin_daemon` service or wherever the query is constructed to use the correct `plugin_id` format. <!-- 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/ce537bb2-de4d-4a85-96f9-14eb0d0c5f2f?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/ce537bb2-de4d-4a85-96f9-14eb0d0c5f2f?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/ce537bb2-de4d-4a85-96f9-14eb0d0c5f2f?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/ce537bb2-de4d-4a85-96f9-14eb0d0c5f2f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ce537bb2-de4d-4a85-96f9-14eb0d0c5f2f?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/ce537bb2-de4d-4a85-96f9-14eb0d0c5f2f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ce537bb2-de4d-4a85-96f9-14eb0d0c5f2f?feedback_type=other)</sup>
Author
Owner

@309299817 commented on GitHub (Apr 8, 2025):

@crazywoola 那我应该怎么去修改,才能解决这个问题?是要修改哪里的源码?

@309299817 commented on GitHub (Apr 8, 2025): @crazywoola 那我应该怎么去修改,才能解决这个问题?是要修改哪里的源码?
Author
Owner

@Yeuoly commented on GitHub (Apr 9, 2025):

It's because of you are using a debugging plugin and it dose not exit as expected, please delete it manually

@Yeuoly commented on GitHub (Apr 9, 2025): It's because of you are using a debugging plugin and it dose not exit as expected, please delete it manually
Author
Owner

@309299817 commented on GitHub (Apr 9, 2025):

@Yeuoly I have repeatedly deleted it

@309299817 commented on GitHub (Apr 9, 2025): @Yeuoly I have repeatedly deleted it
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#80