Bug/LLM nodes with new 'structured output' are missing the 'usage' and 'stopReason' #13617

Closed
opened 2026-02-21 19:13:00 -05:00 by yindo · 4 comments
Owner

Originally created by @mendybraun on GitHub (May 4, 2025).

Originally assigned to: @Nov1c444 on GitHub.

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.3.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

LLM nodes with that uses the new 'structured output' are missing the 'usage' and 'stopReason' in the log.
Image

✔️ Expected Behavior

Image

Actual Behavior

Image

Originally created by @mendybraun on GitHub (May 4, 2025). Originally assigned to: @Nov1c444 on GitHub. ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.3.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce LLM nodes with that uses the new 'structured output' are missing the 'usage' and 'stopReason' in the log. ![Image](https://github.com/user-attachments/assets/22748b0c-8728-4167-9a9f-0b195b3320f7) ### ✔️ Expected Behavior ![Image](https://github.com/user-attachments/assets/d0390838-104f-486a-be1c-e1b92c5f54c8) ### ❌ Actual Behavior ![Image](https://github.com/user-attachments/assets/48c27e27-3030-4253-8ada-645bb5c5a86d)
yindo added the 🐞 bug label 2026-02-21 19:13:00 -05:00
yindo closed this issue 2026-02-21 19:13:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 4, 2025):

The issue you're experiencing with the 'usage' and 'stopReason' fields missing in the log for LLM nodes using the new 'structured output' in Dify version 1.3.1 when self-hosted with Docker is due to the way the code handles these fields. In the file api/core/workflow/nodes/llm/node.py, the fields 'usage' and 'finish_reason' are initially included in the outputs dictionary. However, if structured_output is present, it might override or exclude these fields from being logged or displayed [1].

There are no configuration options or flags mentioned in the available documentation that ensure 'usage' and 'finish_reason' are always included in the output when 'structured_output' is used [1].

For further investigation, you might want to check the code handling the structured_output to see if modifications can be made to include these fields consistently.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (May 4, 2025): <!-- Answer --> The issue you're experiencing with the 'usage' and 'stopReason' fields missing in the log for LLM nodes using the new 'structured output' in Dify version 1.3.1 when self-hosted with Docker is due to the way the code handles these fields. In the file `api/core/workflow/nodes/llm/node.py`, the fields 'usage' and 'finish_reason' are initially included in the `outputs` dictionary. However, if `structured_output` is present, it might override or exclude these fields from being logged or displayed <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/llm/node.py)</sup>. There are no configuration options or flags mentioned in the available documentation that ensure 'usage' and 'finish_reason' are always included in the output when 'structured_output' is used <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/llm/node.py)</sup>. For further investigation, you might want to check the code handling the `structured_output` to see if modifications can be made to include these fields consistently. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/b55a97e4-8653-4879-8ebd-9d0449305a2d?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b55a97e4-8653-4879-8ebd-9d0449305a2d?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b55a97e4-8653-4879-8ebd-9d0449305a2d?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b55a97e4-8653-4879-8ebd-9d0449305a2d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b55a97e4-8653-4879-8ebd-9d0449305a2d?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/b55a97e4-8653-4879-8ebd-9d0449305a2d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b55a97e4-8653-4879-8ebd-9d0449305a2d?feedback_type=other)</sup>
Author
Owner

@Nov1c444 commented on GitHub (May 6, 2025):

Could you please provider the DSL file? This appears to be an intermittent issue.

@Nov1c444 commented on GitHub (May 6, 2025): Could you please provider the DSL file? This appears to be an intermittent issue.
Author
Owner

@DavideDelbianco commented on GitHub (Jul 19, 2025):

maybe this was closed by #21766

@DavideDelbianco commented on GitHub (Jul 19, 2025): maybe this was closed by #21766
Author
Owner

@dosubot[bot] commented on GitHub (Aug 29, 2025):

Hi, @mendybraun. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify v1.3.1 (self-hosted via Docker), LLM nodes using the new 'structured output' feature were missing the 'usage' and 'stopReason' fields in logs.
  • I noted that the code handling these fields in node.py might exclude them when 'structured_output' is enabled, with no current config to always include them.
  • You requested the DSL file to investigate potential intermittent behavior.
  • I suggested that PR #21766 likely resolved this issue.

Next Steps:

  • Please check if this issue still occurs in the latest version of Dify.
  • If it does, feel free to comment here to keep the discussion open; otherwise, this issue will be closed automatically in 15 days.

Thanks for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 29, 2025): Hi, @mendybraun. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify v1.3.1 (self-hosted via Docker), LLM nodes using the new 'structured output' feature were missing the 'usage' and 'stopReason' fields in logs. - I noted that the code handling these fields in `node.py` might exclude them when 'structured_output' is enabled, with no current config to always include them. - You requested the DSL file to investigate potential intermittent behavior. - I suggested that PR #21766 likely resolved this issue. **Next Steps:** - Please check if this issue still occurs in the latest version of Dify. - If it does, feel free to comment here to keep the discussion open; otherwise, this issue will be closed automatically in 15 days. Thanks for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13617