How to set the parameter MAX_TREE_DEPTH when using docker deployment #6854

Closed
opened 2026-02-21 18:17:37 -05:00 by yindo · 3 comments
Owner

Originally created by @JackyMeow on GitHub (Nov 20, 2024).

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

0.11.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When I attempt to refresh my workflow, I encounter an error message indicating that "the nodes exceed the limit of 50." According to the user FAQ, the recommended solution for the community edition is to manually adjust the MAX_TREE_DEPTH limit for single branch depth in the file web/app/components/workflow/constants.ts. The default setting is set at 50, and it's crucial to be aware that overly deep branches could negatively impact performance, especially in self-hosted environments.

However, this solution is not applicable in my case since my deployment is managed through Docker. Therefore, I am seeking guidance on how to configure the MAX_TREE_DEPTH parameter when utilizing Docker for deployment.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @JackyMeow on GitHub (Nov 20, 2024). ### 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 0.11.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When I attempt to refresh my workflow, I encounter an error message indicating that "the nodes exceed the limit of 50." According to the user FAQ, the recommended solution for the community edition is to manually adjust the `MAX_TREE_DEPTH` limit for single branch depth in the file `web/app/components/workflow/constants.ts`. The default setting is set at 50, and it's crucial to be aware that overly deep branches could negatively impact performance, especially in self-hosted environments. However, this solution is not applicable in my case since my deployment is managed through Docker. Therefore, I am seeking guidance on how to configure the `MAX_TREE_DEPTH` parameter when utilizing Docker for deployment. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🙋‍♂️ question label 2026-02-21 18:17:37 -05:00
yindo closed this issue 2026-02-21 18:17:37 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 20, 2024):

Hey @JackyMeow! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's tackle this together!

I found similar issues that might help you with setting the MAX_TREE_DEPTH parameter in a Docker deployment.

  1. 迭代调用。报错:调用工具失败:达到最大工作流调用深度5。 - This issue is closed and suggests exposing MAX_TREE_DEPTH as an environment variable. You can update web/app/components/workflow/constants.ts to read from an environment variable and ensure your Docker setup passes this variable. Here's a brief guide:

    • Modify web/app/components/workflow/constants.ts:

      const MAX_TREE_DEPTH = process.env.MAX_TREE_DEPTH ? parseInt(process.env.MAX_TREE_DEPTH, 10) : 50;
      
    • Update your Docker Compose file to include the environment variable:

      version: '3'
      services:
        app:
          image: your-app-image
          environment:
            - MAX_TREE_DEPTH=100  # or any desired value
      
    • Add the environment variable to your .env file:

      MAX_TREE_DEPTH=100  # or any desired value
      
  2. MAX_TREE_DEPTH can be set via environment variables. - This issue is also closed and provides a similar solution.

After making these changes, restart your Docker services with:

docker compose down
docker compose up -d

Be cautious about increasing the depth too much, as it may impact performance [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 20, 2024): <!-- Greeting --> Hey @JackyMeow! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's tackle this together! <!-- Answer --> I found similar issues that might help you with setting the `MAX_TREE_DEPTH` parameter in a Docker deployment. 1. [迭代调用。报错:调用工具失败:达到最大工作流调用深度5。](https://github.com/langgenius/dify/issues/5144) - This issue is closed and suggests exposing `MAX_TREE_DEPTH` as an environment variable. You can update `web/app/components/workflow/constants.ts` to read from an environment variable and ensure your Docker setup passes this variable. Here's a brief guide: - Modify `web/app/components/workflow/constants.ts`: ```typescript const MAX_TREE_DEPTH = process.env.MAX_TREE_DEPTH ? parseInt(process.env.MAX_TREE_DEPTH, 10) : 50; ``` - Update your Docker Compose file to include the environment variable: ```yaml version: '3' services: app: image: your-app-image environment: - MAX_TREE_DEPTH=100 # or any desired value ``` - Add the environment variable to your `.env` file: ```example MAX_TREE_DEPTH=100 # or any desired value ``` 2. [MAX_TREE_DEPTH can be set via environment variables.](https://github.com/langgenius/dify/issues/8245) - This issue is also closed and provides a similar solution. After making these changes, restart your Docker services with: ```bash docker compose down docker compose up -d ``` Be cautious about increasing the depth too much, as it may impact performance <sup>[[1]](https://github.com/langgenius/dify/issues/5144)</sup><sup>[[2]](https://github.com/langgenius/dify/issues/8245)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Nov 20, 2024):

Changing the source need to build the web container manually.

@crazywoola commented on GitHub (Nov 20, 2024): Changing the source need to build the web container manually.
Author
Owner

@JackyMeow commented on GitHub (Nov 22, 2024):

I hope this parameter setting MAX_TREE_DEPTH could be exported in .env file in the future vision.

@JackyMeow commented on GitHub (Nov 22, 2024): I hope this parameter setting MAX_TREE_DEPTH could be exported in `.env` file in the future vision.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6854