LLM node structured output not working in streaming mode #19575

Closed
opened 2026-02-21 20:01:28 -05:00 by yindo · 0 comments
Owner

Originally created by @white-loub on GitHub (Oct 18, 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.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a Chatflow application
  2. Add an LLM node and enable "Structured Output" in node settings
  3. Configure a JSON schema, for example:
{
  "type": "object",
  "properties": {
    "selected_agent": {"type": "string"},
    "reason": {"type": "string"}
  },
  "required": ["selected_agent", "reason"]
}
  1. Add a downstream node (e.g., Code node or IF/ELSE node)
  2. Try to reference the structured output field: {{#node_id.structured_output.selected_agent#}}
  3. Run the Chatflow

Error message:

Variable ['node_id', 'structured_output', 'selected_agent'] not found

Observation:

  • The LLM generates valid JSON according to the schema
  • The JSON appears in the text field instead of structured_output field
  • Downstream nodes cannot access structured_output variables

✔️ Expected Behavior

When "Structured Output" is enabled in the LLM node:

  1. The LLM node should parse and return the JSON in the structured_output field
  2. Downstream nodes should be able to access structured output variables like {{#node_id.structured_output.field_name#}}
  3. The structured output should be available to downstream nodes

Actual Behavior

In Chatflow, the structured_output field is missing from the LLM node output:

  1. LLM correctly generates JSON according to the schema
  2. However, the JSON is returned in the text field, not structured_output
  3. Downstream nodes fail with "Variable not found" when trying to access structured_output fields
Originally created by @white-loub on GitHub (Oct 18, 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.9.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Create a **Chatflow** application 2. Add an LLM node and enable "Structured Output" in node settings 3. Configure a JSON schema, for example: ```json { "type": "object", "properties": { "selected_agent": {"type": "string"}, "reason": {"type": "string"} }, "required": ["selected_agent", "reason"] } ``` 4. Add a downstream node (e.g., Code node or IF/ELSE node) 5. Try to reference the structured output field: `{{#node_id.structured_output.selected_agent#}}` 6. Run the Chatflow **Error message:** ``` Variable ['node_id', 'structured_output', 'selected_agent'] not found ``` **Observation:** - The LLM generates valid JSON according to the schema - The JSON appears in the `text` field instead of `structured_output` field - Downstream nodes cannot access `structured_output` variables ### ✔️ Expected Behavior When "Structured Output" is enabled in the LLM node: 1. The LLM node should parse and return the JSON in the `structured_output` field 2. Downstream nodes should be able to access structured output variables like `{{#node_id.structured_output.field_name#}}` 3. The structured output should be available to downstream nodes ### ❌ Actual Behavior In Chatflow, the `structured_output` field is missing from the LLM node output: 1. LLM correctly generates JSON according to the schema 2. However, the JSON is returned in the `text` field, not `structured_output` 3. Downstream nodes fail with "Variable not found" when trying to access `structured_output` fields
yindo added the 🐞 bug label 2026-02-21 20:01:28 -05:00
yindo closed this issue 2026-02-21 20:01:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#19575