[Refactor/Chore] Add preflight workflow validation and actionable diagnostics for missing variable references / unreachable paths
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### 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 refactors or chores; 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.
### Description
**Description**
When an Advanced Workflow contains graph or variable-dependency mistakes, the current UX/backend feedback is too opaque. In my case, the chat stayed on `cacheing variables`, SSE returned `internal_server_error`, and the frontend then requested suggested questions for an answer placeholder and got `404`. The actual root causes were workflow structure and variable-reference issues, such as missing variables from parallel or conditional branches (for example in my case `#1440.text#` and `#1811.text#`).
I am proposing a refactor/chore to improve workflow validation and runtime diagnostics so authors can identify these issues before or during execution, instead of only seeing generic server errors.
### Motivation
Now it is hard to tell whether a failure is caused by:
* an unreachable path in the workflow graph,
* a missing edge after refactoring,
* a node referencing output from a conditional branch that did not execute,
* or a node depending on parallel branch outputs that were never produced.
A better developer experience would include:
* preflight validation before publish/run,
* node-level error messages,
* variable dependency checks for conditional/parallel paths,
* and a clearer frontend failure state instead of hanging on `cacheing variables`.
### Additional Context
Suggested checks:
1. Warn if a node references another node’s output that is not guaranteed on all paths.
2. Warn if a downstream node depends on multiple parallel branches without safe fallback/join semantics.
3. Show node id + variable path in runtime errors.
4. Avoid follow-up frontend calls like suggested questions when the answer was never successfully created.
This would help workflow authors debug issues much faster and reduce generic `internal_server_error` cases that are actually workflow-definition problems. The failures I observed were reproducible in a real workflow + batch test, including compare-path missing variables and optimization-path missing variables.
Contributor guide
Assessment
This issue has not been assessed yet.