Skip to content

Fix issue #38655: missing-variable Jinja branch crash - #39153

Open
natemiller23 wants to merge 1 commit into
langgenius:mainfrom
natemiller23:fix/openjobs-38655-missing-var-jinja
Open

Fix issue #38655: missing-variable Jinja branch crash#39153
natemiller23 wants to merge 1 commit into
langgenius:mainfrom
natemiller23:fix/openjobs-38655-missing-var-jinja

Conversation

@natemiller23

Copy link
Copy Markdown

Fixes https://github.com/langgenius/dify/issues/38655\n\nOpenJobs: https://openjobs.bot/jobs/b13fc23b-8eff-477a-afa3-79bdcd77f665\nListing ID: b13fc23b-8eff-477a-afa3-79bdcd77f665\nMentioning openjobs.bot as required.\n\nWhat changed:\n- Filter missing upstream Jinja variables before constructing LLM prompt inputs so absent branch outputs stay undefined in Jinja instead of crashing template preparation.\n- Added a regression test covering a branch-fed LLM prompt where one Jinja variable is present and one is missing.\n\nTesting notes:\n- uv run --project api --no-default-groups --group dev pytest api/tests/unit_tests/core/workflow/test_node_factory.py -q\n- Result: 55 passed, 2 warnings\n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using conditional branches (if) and Jinja2 templates in combination, Dify may fail directly if the dependent variable does not exist.

1 participant