Skip to content

Dynamic select options broken when trigger throws exception #280

@Mairuis

Description

@Mairuis

Description

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 for the plugin. This causes an unhandled exception that breaks the dynamic select functionality entirely.

Steps to Reproduce

  1. Create a plugin with a tool that uses dynamic-select parameter type
  2. The plugin does NOT register any trigger providers
  3. Attempt to use the dynamic select in Dify

Expected Behavior

Dynamic select options should load correctly and allow users to select from the available options.

Actual Behavior

An exception is thrown in TriggerFactory.get_trigger_event_handler_safely() when it tries to find a trigger provider that doesn't exist, causing the dynamic select to fail.

Root Cause

The get_trigger_event_handler_safely() method in trigger_factory.py calls _get_entry() which raises a ValueError when the provider is not found. This exception was not caught, causing the entire dynamic select flow to break.

Solution

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions