A breaking change, Output variable length limit of workflow Code Node #5235

Closed
opened 2026-02-21 18:10:00 -05:00 by yindo · 2 comments
Owner

Originally created by @cherry0411 on GitHub (Aug 26, 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.7.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

After upgrade to 0.7.2, If Code Node results an string variable that longer than 30 characters, it will cause an error: The length of output variable res must be less than 30 characters. In my most use cases 30 characters is not very enough, like image path extract, construct prom
issues_3
pt, etc. So may I ask why we should have this limit?

✔️ Expected Behavior

String output variable should have longer limit, like 1000.

Actual Behavior

Node report an error.

Originally created by @cherry0411 on GitHub (Aug 26, 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.7.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce After upgrade to 0.7.2, If Code Node results an string variable that longer than 30 characters, it will cause an error: The length of output variable res must be less than 30 characters. In my most use cases 30 characters is not very enough, like image path extract, construct prom ![issues_3](https://github.com/user-attachments/assets/562e07fd-3f59-41a2-a9ce-e813f51dde2a) pt, etc. So may I ask why we should have this limit? ### ✔️ Expected Behavior String output variable should have longer limit, like 1000. ### ❌ Actual Behavior Node report an error.
yindo added the 🐞 bug label 2026-02-21 18:10:00 -05:00
yindo closed this issue 2026-02-21 18:10:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 26, 2024):

The 30-character limit on the output variable length in the Code Node of the workflow is defined by the configuration parameter dify_config.CODE_MAX_STRING_ARRAY_LENGTH. This limit is enforced in the _check_string method of the CodeNode class. To increase this limit to 1000 characters, you would need to change the value of dify_config.CODE_MAX_STRING_ARRAY_LENGTH to 1000 in the configuration settings [1].

The dify_config module or configuration file is located in the api/configs/app_config.py file. It is structured as a class named DifyConfig that inherits from several other configuration classes [2].

For a self-hosted Dify instance using Docker, you can apply configuration changes by modifying the environment variables in the .env file and then restarting the Docker containers. Here are the steps:

  1. Edit the .env file:

    • Navigate to the dify/docker directory.
    • Edit the .env file to reflect the desired configuration changes.
  2. Restart the Docker containers:

    • Run the following commands to apply the changes:
      docker compose down
      docker compose up -d
      

This process ensures that the new configuration settings are loaded and applied to the Dify instance [3][4][5][6][7].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 26, 2024): <!-- Answer --> The 30-character limit on the output variable length in the Code Node of the workflow is defined by the configuration parameter `dify_config.CODE_MAX_STRING_ARRAY_LENGTH`. This limit is enforced in the `_check_string` method of the `CodeNode` class. To increase this limit to 1000 characters, you would need to change the value of `dify_config.CODE_MAX_STRING_ARRAY_LENGTH` to 1000 in the configuration settings <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/code/code_node.py)</sup>. The `dify_config` module or configuration file is located in the `api/configs/app_config.py` file. It is structured as a class named `DifyConfig` that inherits from several other configuration classes <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/configs/app_config.py)</sup>. For a self-hosted Dify instance using Docker, you can apply configuration changes by modifying the environment variables in the `.env` file and then restarting the Docker containers. Here are the steps: 1. **Edit the `.env` file**: - Navigate to the `dify/docker` directory. - Edit the `.env` file to reflect the desired configuration changes. 2. **Restart the Docker containers**: - Run the following commands to apply the changes: ```bash docker compose down docker compose up -d ``` This process ensures that the new configuration settings are loaded and applied to the Dify instance <sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/jp/getting-started/install-self-hosted/docker-compose.md)</sup><sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/docker-compose.md)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/docker-compose.md)</sup><sup>[[6]](https://github.com/langgenius/dify/blob/main/README_FR.md)</sup><sup>[[7]](https://github.com/langgenius/dify/blob/main/README_ES.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Aug 26, 2024):

Already fixed in https://github.com/langgenius/dify/pull/7683

@crazywoola commented on GitHub (Aug 26, 2024): Already fixed in https://github.com/langgenius/dify/pull/7683
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5235