errors caused by features being null when using an agent in a workflow #12627

Closed
opened 2026-02-21 19:08:16 -05:00 by yindo · 1 comment
Owner

Originally created by @LeeeeeeM on GitHub (Apr 7, 2025).

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

current main

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1、create a chatflow
2、create an agent node
3、 features is null

Image

✔️ Expected Behavior

no error

Actual Behavior

error

Originally created by @LeeeeeeM on GitHub (Apr 7, 2025). ### 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 current main ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1、create a chatflow 2、create an agent node 3、 features is null ![Image](https://github.com/user-attachments/assets/63bc0774-1c6a-49d6-a391-16c6a5817598) ### ✔️ Expected Behavior no error ### ❌ Actual Behavior error
yindo added the 🐞 bug label 2026-02-21 19:08:16 -05:00
yindo closed this issue 2026-02-21 19:08:16 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 7, 2025):

To resolve the "Unhandled Runtime Error" in the AgentPanel component, specifically the "Cannot read properties of null (reading 'includes')" error, you need to ensure that currentStrategy?.features is not null or undefined before calling the includes method. You can achieve this by adding a nullish coalescing operator or a conditional check. Here's an example of how you can modify the code:

if (currentStrategy?.features?.includes(AgentFeature.SomeFeature)) {
  // Your logic here
}

This change ensures that the includes method is only called if currentStrategy?.features is not null or undefined [1].

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 (Apr 7, 2025): <!-- Answer --> To resolve the "Unhandled Runtime Error" in the `AgentPanel` component, specifically the "Cannot read properties of null (reading 'includes')" error, you need to ensure that `currentStrategy?.features` is not `null` or `undefined` before calling the `includes` method. You can achieve this by adding a nullish coalescing operator or a conditional check. Here's an example of how you can modify the code: ```tsx if (currentStrategy?.features?.includes(AgentFeature.SomeFeature)) { // Your logic here } ``` This change ensures that the `includes` method is only called if `currentStrategy?.features` is not `null` or `undefined` <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/agent/panel.tsx)</sup>. <!-- 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/26593ecd-03a4-4b7f-bef9-b89ea77fe088?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/26593ecd-03a4-4b7f-bef9-b89ea77fe088?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/26593ecd-03a4-4b7f-bef9-b89ea77fe088?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/26593ecd-03a4-4b7f-bef9-b89ea77fe088?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/26593ecd-03a4-4b7f-bef9-b89ea77fe088?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/26593ecd-03a4-4b7f-bef9-b89ea77fe088?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/26593ecd-03a4-4b7f-bef9-b89ea77fe088?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12627