CODE_MAX_STRING_ARRAY_LENGTH parameter is invalid #6535

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

Originally created by @nooooom on GitHub (Nov 4, 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.10.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

CODE_MAX_STRING_ARRAY_LENGTH parameter is invalid.I noticed a similar error in the previous issues in version 0.7.2, but now it appears again in version 0.10.2

✔️ Expected Behavior

The code node verifies the set length when returning the string array

Actual Behavior

image
image

Originally created by @nooooom on GitHub (Nov 4, 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.10.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce CODE_MAX_STRING_ARRAY_LENGTH parameter is invalid.I noticed a similar error in the previous issues in version 0.7.2, but now it appears again in version 0.10.2 ### ✔️ Expected Behavior The code node verifies the set length when returning the string array ### ❌ Actual Behavior ![image](https://github.com/user-attachments/assets/18ad32a0-d1f5-44ac-baf8-2be996e03ed3) ![image](https://github.com/user-attachments/assets/7e790890-b8e0-4499-ad97-9d1fdf14bb3a)
yindo added the 🐞 bug label 2026-02-21 18:16:11 -05:00
yindo closed this issue 2026-02-21 18:16:11 -05:00
Author
Owner

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

@nooooom Hello there! I'm here to help you with bugs, answer questions, and guide you on becoming a contributor. Let's work together to resolve the issue you're facing while we wait for a human maintainer.

The CODE_MAX_STRING_ARRAY_LENGTH parameter is used to enforce a maximum length constraint on string arrays during code execution. If the length of a string array exceeds the specified maximum (default is 30), it raises an OutputValidationError [1][2].

In your case, it seems like the parameter is being considered invalid, which might be due to the string array exceeding this maximum length. Ensure that the string arrays being processed do not exceed the length specified by CODE_MAX_STRING_ARRAY_LENGTH. If you need to allow longer arrays, you can adjust this parameter in your configuration, particularly in the Docker setup, where it defaults to 30 unless specified otherwise [3].

If this issue was present in version 0.7.2 and has reappeared in version 0.10.2, it might be worth checking if there have been any recent changes or commits related to this parameter that could have reintroduced the issue. Unfortunately, I couldn't find specific changes between these versions regarding this parameter [4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 4, 2024): <!-- Greeting --> @nooooom Hello there! I'm here to help you with bugs, answer questions, and guide you on becoming a contributor. Let's work together to resolve the issue you're facing while we wait for a human maintainer. <!-- Answer --> The `CODE_MAX_STRING_ARRAY_LENGTH` parameter is used to enforce a maximum length constraint on string arrays during code execution. If the length of a string array exceeds the specified maximum (default is 30), it raises an `OutputValidationError` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/.env.example)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/code/code_node.py)</sup>. In your case, it seems like the parameter is being considered invalid, which might be due to the string array exceeding this maximum length. Ensure that the string arrays being processed do not exceed the length specified by `CODE_MAX_STRING_ARRAY_LENGTH`. If you need to allow longer arrays, you can adjust this parameter in your configuration, particularly in the Docker setup, where it defaults to 30 unless specified otherwise <sup>[[3]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup>. If this issue was present in version 0.7.2 and has reappeared in version 0.10.2, it might be worth checking if there have been any recent changes or commits related to this parameter that could have reintroduced the issue. Unfortunately, I couldn't find specific changes between these versions regarding this parameter <sup>[[4]](https://github.com/langgenius/dify/blob/main/api/configs/feature/__init__.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@Hisir0909 commented on GitHub (Nov 4, 2024):

Please modify it in .env. .env has default values, so the 3000 you specified in the compose file won't be used.

@Hisir0909 commented on GitHub (Nov 4, 2024): Please modify it in `.env`. `.env` has default values, so the 3000 you specified in the compose file won't be used.
Author
Owner

@nooooom commented on GitHub (Nov 4, 2024):

Please modify it in .env. .env has default values, so the 3000 you specified in the compose file won't be used.

Thanks bro, it's solved!

@nooooom commented on GitHub (Nov 4, 2024): > Please modify it in `.env`. `.env` has default values, so the 3000 you specified in the compose file won't be used. Thanks bro, it's solved!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6535