Repository navigation
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for a bug report.
- I searched existing open and closed issues.
- I am submitting this report in English.
- I did not modify the required issue sections.
Dify version
1.17.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Use a plugin tool with an optional file or files form parameter. For example:
parameters:
- name: image
type: files
required: false
label:
en_US: Reference images
human_description:
en_US: Optional reference images.
llm_description: Optional reference images.
form: form
- name: image_urls
type: string
required: false
label:
en_US: Reference image URLs
human_description:
en_US: Optional reference image URLs.
llm_description: Optional reference image URLs.
form: form- Create a workflow with a Start node containing an
Array[File]input. - Add the plugin tool node.
- Select
Start / inputfor the optionalimageparameter. - Clear the selected variable.
- Save or run the workflow.
The cleared input is persisted as an empty variable selector instead of an unset value:
{"type":"variable","value":[]}An empty string can also exist in serialized drafts:
{"type":"variable","value":""}This was re-verified against the Dify 1.17.0 release tag (09a855dcef24c0edc7431c46c0cfaa494481daf5) and current main (0d8ad27b14d1efc19613b20018e5483fa93f8e5c, 2026-09-04).
The 1.17.0 runtime conversion path produces these failures for the two empty selector forms:
'': ValidationError: value must be a list
[]: ToolParameterError: Variable [] does not exist
Focused regression tests on current main also reproduce both sides before a fix:
- Frontend: 2 failures; clearing optional
fileandfilesinputs emits{type: "variable", value: []}. - Backend: 4 failures; optional
fileandfilesinputs with""or[]are validated or resolved instead of treated as unset.
✔️ Expected Behavior
Clearing an optional file or files parameter should restore a canonical unset state, such as:
{"type":"constant","value":null}Existing drafts containing an empty optional variable selector should also run without trying to resolve that selector.
Required parameters and non-empty malformed selectors should retain their current validation behavior.
❌ Actual Behavior
Clearing an optional file selector keeps type: "variable" with an empty string or empty array value. Workflow execution then fails before the plugin is invoked with either value must be a list or Variable [] does not exist.
Activity
stevenup commentedon Sep 4, 2026
I would like to work on this fix and have a regression-tested patch ready. Could a maintainer please assign this issue to @stevenup?
dosubot commentedon Sep 4, 2026
@stevenup, this matches the same underlying bug from #39045, which was closed because the original report targeted Dify 1.13.0. The gap is still present on current
main:handleVariableSelectorChange()always keepstype: VarKindType.variableand delegates tonormalizeVariableSelectorValue(), which coerces a falsy (cleared) input to''— it never resets to an unset constant._convert_tool_parameters_type()skips a parameter only whenconfig.get("value") is not None. An empty string or empty list passes that check and gets validated as a real variable selector, producing eitherValidationError: value must be a listorToolParameterError: Variable [] does not exist.Your open PR #39195 already addresses both sides — resetting a cleared optional file/files selector to
{"type":"constant","value":null}on the frontend, and having the backend ignore stale empty optional variable selectors — with regression tests covering the""and[]cases.Since #39045 was closed for version-scope reasons rather than being resolved, and this report reconfirms the bug on 1.17.0 and current
main, it may be worth a maintainer revisiting PR #39195 rather than requiring a fresh fix.To reply, just mention @dosu.
Docs are dead. Just use Dosu.