[PR #281] fix: handle exception in dynamic select options when trigger is not registered #281

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

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-sdks/pull/281
Author: @Mairuis
Created: 1/12/2026
Status: 🔄 Open

Base: mainHead: fix/dynamic-select-trigger-exception


📝 Commits (1)

  • 284878e fix: handle exception in dynamic select options when trigger is not registered

📊 Changes

1 file changed (+8 additions, -4 deletions)

View changed files

📝 python/dify_plugin/core/trigger_factory.py (+8 -4)

📄 Description

Summary

  • Fix unhandled exception in get_trigger_event_handler_safely() that broke dynamic select options
  • Added try-except block to gracefully handle cases where trigger provider is not registered

Problem

When using dynamic-select parameter type in tools or models, the plugin executor attempts to get a trigger event handler even when no trigger is registered. The _get_entry() method raises a ValueError when the provider is not found, and this exception was not caught, breaking the entire dynamic select functionality.

Solution

Wrapped the method body in a try-except block to catch any exceptions and return None gracefully. This allows dynamic select to function correctly even when triggers are not involved.

Closes #280


🔄 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/281 **Author:** [@Mairuis](https://github.com/Mairuis) **Created:** 1/12/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/dynamic-select-trigger-exception` --- ### 📝 Commits (1) - [`284878e`](https://github.com/langgenius/dify-plugin-sdks/commit/284878ec5ab6e2fc83477290e620e903e4351b34) fix: handle exception in dynamic select options when trigger is not registered ### 📊 Changes **1 file changed** (+8 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `python/dify_plugin/core/trigger_factory.py` (+8 -4) </details> ### 📄 Description ## Summary - Fix unhandled exception in `get_trigger_event_handler_safely()` that broke dynamic select options - Added try-except block to gracefully handle cases where trigger provider is not registered ## Problem When using `dynamic-select` parameter type in tools or models, the plugin executor attempts to get a trigger event handler even when no trigger is registered. The `_get_entry()` method raises a `ValueError` when the provider is not found, and this exception was not caught, breaking the entire dynamic select functionality. ## Solution Wrapped the method body in a try-except block to catch any exceptions and return `None` gracefully. This allows dynamic select to function correctly even when triggers are not involved. Closes #280 --- <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:34 -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#281