Workflow API ignores default values for optional input variables #20495

Closed
opened 2026-02-21 20:07:41 -05:00 by yindo · 1 comment
Owner

Originally created by @importcjj on GitHub (Nov 22, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a workflow with a start node
  2. Add an optional input variable with a default value (e.g., text input with default "hello")
  3. Call the workflow API without providing that optional field
  4. The variable receives null instead of the default value "hello"

✔️ Expected Behavior

Optional workflow input variables should use their configured default values when not provided in the API request.

Actual Behavior

Optional variables receive null when omitted from the API request, ignoring the default value configuration.

Originally created by @importcjj on GitHub (Nov 22, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.10.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Create a workflow with a start node 2. Add an optional input variable with a default value (e.g., text input with default "hello") 3. Call the workflow API without providing that optional field 4. The variable receives `null` instead of the default value "hello" ### ✔️ Expected Behavior Optional workflow input variables should use their configured default values when not provided in the API request. ### ❌ Actual Behavior Optional variables receive `null` when omitted from the API request, ignoring the default value configuration.
yindo added the 🐞 bug🌊 feat:workflow labels 2026-02-21 20:07:41 -05:00
yindo closed this issue 2026-02-21 20:07:42 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 22, 2025):

This is a confirmed limitation in Dify v1.10.0: when you call the workflow API and omit optional input variables that have default values configured, those variables are set to null instead of using their defaults. The backend does not currently apply default values for omitted optional inputs—defaults are only respected in the UI, not in API-driven workflows. This behavior is due to how the API controller and input preparation logic work: if an input is missing, it stays as None/null and the default is ignored in the backend flow (source).

Until this is fixed, the best workaround is to always provide all input variables in your API payload, even if they have defaults set in the workflow editor (source). There is no backend config or flag to change this behavior at the moment. If you want to track or contribute to a fix, the relevant logic is in the input preparation and workflow start node code (source, source).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 22, 2025): <!-- Answer --> This is a confirmed limitation in Dify v1.10.0: when you call the workflow API and omit optional input variables that have default values configured, those variables are set to `null` instead of using their defaults. The backend does not currently apply default values for omitted optional inputs—defaults are only respected in the UI, not in API-driven workflows. This behavior is due to how the API controller and input preparation logic work: if an input is missing, it stays as `None`/`null` and the default is ignored in the backend flow ([source](https://github.com/langgenius/dify/blob/1dfde240cbfe5dcf42028d0331431e0afd813351/api/core/app/apps/base_app_generator.py#L25-L159)). Until this is fixed, the best workaround is to always provide all input variables in your API payload, even if they have defaults set in the workflow editor ([source](https://github.com/langgenius/dify/issues/21638)). There is no backend config or flag to change this behavior at the moment. If you want to track or contribute to a fix, the relevant logic is in the input preparation and workflow start node code ([source](https://github.com/langgenius/dify/blob/1dfde240cbfe5dcf42028d0331431e0afd813351/api/core/app/apps/base_app_generator.py#L25-L159), [source](https://github.com/langgenius/dify/blob/1dfde240cbfe5dcf42028d0331431e0afd813351/api/core/workflow/nodes/start/start_node.py#L43-L53)). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/0d81a112-63ee-4907-a376-34e0752f0a83?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0d81a112-63ee-4907-a376-34e0752f0a83?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0d81a112-63ee-4907-a376-34e0752f0a83?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0d81a112-63ee-4907-a376-34e0752f0a83?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0d81a112-63ee-4907-a376-34e0752f0a83?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0d81a112-63ee-4907-a376-34e0752f0a83?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0d81a112-63ee-4907-a376-34e0752f0a83?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20confirmed%20limitation%20in%20Dify%20v1.10.0%3A%20when%20you%20call%20the%20workflow%20API%20and%20omit%20optional%20input%20variables%20that%20have%20default%20values%20configured%2C%20those%20variables%20are%20set%20to%20%60null%60%20instead%20of%20using%20their%20defaults.%20The%20backend%20does%20not%20currently%20apply%20default%20values%20for%20omitted%20optional%20inputs%E2%80%94defaults%20are%20only%20respected%20in%20the%20UI%2C%20not%20in%20API-driven%20workflows.%20This%20behavior%20is%20due%20to%20how%20the%20API%20controller%20and%20input%20preparation%20logic%20work%3A%20if%20an%20input%20is%20missing%2C%20it%20stays%20as%20%60None%60/%60null%60%20and%20the%20default%20is%20ignored%20in%20the%20backend%20flow%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/1dfde240cbfe5dcf42028d0331431e0afd813351/api/core/app/apps/base_app_generator.py%23L25-L159%29%29.%0A%0AUntil%20this%20is%20fixed%2C%20the%20best%20workaround%20is%20to%20always%20provide%20all%20input%20variables%20in%20your%20API%20payload%2C%20even%20if%20they%20have%20defaults%20set%20in%20the%20workflow%20editor%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/21638%29%29.%20There%20is%20no%20backend%20config%20or%20flag%20to%20change%20this%20behavior%20at%20the%20moment.%20If%20you%20want%20to%20track%20or%20contribute%20to%20a%20fix%2C%20the%20relevant%20logic%20is%20in%20the%20input%20preparation%20and%20workflow%20start%20node%20code%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/1dfde240cbfe5dcf42028d0331431e0afd813351/api/core/app/apps/base_app_generator.py%23L25-L159%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/1dfde240cbfe5dcf42028d0331431e0afd813351/api/core/workflow/nodes/start/start_node.py%23L43-L53%29%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28546)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20495