[PR #261] fix: get event handler safely #268

Open
opened 2026-02-15 21:16:30 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-sdks/pull/261
Author: @wylswz
Created: 12/8/2025
Status: 🔄 Open

Base: mainHead: fix/get_handler_safely


📝 Commits (3)

  • 315cf7a fix: get event handler safely
  • 88f5b3e Update python/dify_plugin/core/trigger_factory.py
  • ad34657 Update python/dify_plugin/core/trigger_factory.py

📊 Changes

1 file changed (+3 additions, -1 deletions)

View changed files

📝 python/dify_plugin/core/trigger_factory.py (+3 -1)

📄 Description

Pull Request Checklist

An error occurred in dynamic-options API when trying to get dynamic parameters for search repository tool of github plugin. get_trigger_event_handler_safely seems not safely handling ValueError

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/io_server.py", line 94, in _execute_request_in_thread
    self._execute_request(
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/plugin.py", line 455, in _execute_request
    response = self.dispatch(session, data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 79, in dispatch
    return route.func(session, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 72, in wrapper
    return f(session, data)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 607, in fetch_parameter_options
    action_instance: DynamicSelectProtocol | None = self._get_dynamic_parameter_action(session=session, data=data)
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 453, in _get_dynamic_parameter_action
    trigger_event: Event | None = self.registration.try_get_trigger_event_handler(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_registration.py", line 520, in try_get_trigger_event_handler
    return self.trigger_factory.get_trigger_event_handler_safely(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 143, in get_trigger_event_handler_safely
    entry = self._get_entry(provider_name)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 181, in _get_entry
    raise ValueError(f"Trigger provider `{provider_name}` not found") from exc
ValueError: Trigger provider `github` not found
127.0.0.1 - - [2025-12-08 07:42:06] "POST /invoke?action=fetch_parameter_options HTTP/1.0" 200 410 0.001878
Unexpected error occurred when executing request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 179, in _get_entry
    return self._providers[provider_name]
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'github'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/io_server.py", line 94, in _execute_request_in_thread
    self._execute_request(
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/plugin.py", line 455, in _execute_request
    response = self.dispatch(session, data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 79, in dispatch
    return route.func(session, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 72, in wrapper
    return f(session, data)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 607, in fetch_parameter_options
    action_instance: DynamicSelectProtocol | None = self._get_dynamic_parameter_action(session=session, data=data)
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 453, in _get_dynamic_parameter_action
    trigger_event: Event | None = self.registration.try_get_trigger_event_handler(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_registration.py", line 520, in try_get_trigger_event_handler
    return self.trigger_factory.get_trigger_event_handler_safely(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 143, in get_trigger_event_handler_safely
    entry = self._get_entry(provider_name)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 181, in _get_entry
    raise ValueError(f"Trigger provider `{provider_name}` not found") from exc
ValueError: Trigger provider `github` not found

Compatibility Check

  • I have checked whether this change affects the backward compatibility of the plugin declared in README.md
  • I have checked whether this change affects the forward compatibility of the plugin declared in README.md
  • If this change introduces a breaking change, I have discussed it with the project maintainer and specified the release version in the README.md
  • I have described the compatibility impact and the corresponding version number in the PR description
  • I have checked whether the plugin version is updated in the README.md

Available Checks

  • Code has passed local tests
  • Relevant documentation has been updated (if necessary)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-plugin-sdks/pull/261 **Author:** [@wylswz](https://github.com/wylswz) **Created:** 12/8/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/get_handler_safely` --- ### 📝 Commits (3) - [`315cf7a`](https://github.com/langgenius/dify-plugin-sdks/commit/315cf7a23cb3d121f2fd8f0d64daff751deb69ad) fix: get event handler safely - [`88f5b3e`](https://github.com/langgenius/dify-plugin-sdks/commit/88f5b3e28b37953d7a85804526d0c457aa1b1dbe) Update python/dify_plugin/core/trigger_factory.py - [`ad34657`](https://github.com/langgenius/dify-plugin-sdks/commit/ad3465712277571a6acdeda4d95f0b3315c151a8) Update python/dify_plugin/core/trigger_factory.py ### 📊 Changes **1 file changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `python/dify_plugin/core/trigger_factory.py` (+3 -1) </details> ### 📄 Description # Pull Request Checklist An error occurred in `dynamic-options` API when trying to get dynamic parameters for `search repository` tool of `github` plugin. `get_trigger_event_handler_safely` seems not safely handling `ValueError` ``` Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/io_server.py", line 94, in _execute_request_in_thread self._execute_request( File "/usr/local/lib/python3.12/site-packages/dify_plugin/plugin.py", line 455, in _execute_request response = self.dispatch(session, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 79, in dispatch return route.func(session, data) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 72, in wrapper return f(session, data) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 607, in fetch_parameter_options action_instance: DynamicSelectProtocol | None = self._get_dynamic_parameter_action(session=session, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 453, in _get_dynamic_parameter_action trigger_event: Event | None = self.registration.try_get_trigger_event_handler( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_registration.py", line 520, in try_get_trigger_event_handler return self.trigger_factory.get_trigger_event_handler_safely( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 143, in get_trigger_event_handler_safely entry = self._get_entry(provider_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 181, in _get_entry raise ValueError(f"Trigger provider `{provider_name}` not found") from exc ValueError: Trigger provider `github` not found 127.0.0.1 - - [2025-12-08 07:42:06] "POST /invoke?action=fetch_parameter_options HTTP/1.0" 200 410 0.001878 Unexpected error occurred when executing request Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 179, in _get_entry return self._providers[provider_name] ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ KeyError: 'github' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/io_server.py", line 94, in _execute_request_in_thread self._execute_request( File "/usr/local/lib/python3.12/site-packages/dify_plugin/plugin.py", line 455, in _execute_request response = self.dispatch(session, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 79, in dispatch return route.func(session, data) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/router.py", line 72, in wrapper return f(session, data) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 607, in fetch_parameter_options action_instance: DynamicSelectProtocol | None = self._get_dynamic_parameter_action(session=session, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 453, in _get_dynamic_parameter_action trigger_event: Event | None = self.registration.try_get_trigger_event_handler( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/plugin_registration.py", line 520, in try_get_trigger_event_handler return self.trigger_factory.get_trigger_event_handler_safely( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 143, in get_trigger_event_handler_safely entry = self._get_entry(provider_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/trigger_factory.py", line 181, in _get_entry raise ValueError(f"Trigger provider `{provider_name}` not found") from exc ValueError: Trigger provider `github` not found ``` ## Compatibility Check - [ ] I have checked whether this change affects the **backward compatibility** of the plugin declared in `README.md` - [ ] I have checked whether this change affects the **forward compatibility** of the plugin declared in `README.md` - [ ] If this change introduces a breaking change, I have discussed it with the project maintainer and specified the release version in the `README.md` - [ ] I have described the compatibility impact and the corresponding version number in the PR description - [ ] I have checked whether the plugin version is updated in the `README.md` ## Available Checks - [ ] Code has passed local tests - [ ] Relevant documentation has been updated (if necessary) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 21:16:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-sdks#268