Closed Emasoft closed 44 minutes ago
The issue you're encountering is due to a limit set in Dify version 0.9.1, where the output variable result
must be less than 80,000 characters. This is controlled by the CODE_MAX_STRING_LENGTH
configuration, which is indeed set to 80,000 characters by default [1].
To resolve this, you can increase the limit by setting the CODE_MAX_STRING_LENGTH
environment variable to a higher value. Here's how you can do it:
Set the environment variable in your configuration or .env
file:
CODE_MAX_STRING_LENGTH=160000 # Example: setting it to 160,000 characters
Restart your application to apply the changes.
This should allow your code block to handle larger outputs.
To continue talking to Dosu, mention @dosu.
Then you should open a Feature Request to make the value CODE_MAX_STRING_LENGTH customizable at runtime for each workflow. You can’t force the user to restart the application anytime. Not to mention the Cloud version of Dify that cannot be restarted by the users. Different workflows have different needs. This limit must be set by the user according to what kind of data he processes.
We do not plan to adjust this value in our cloud version.
Self Checks
Dify version
0.9.1
Cloud or Self Hosted
Cloud
Steps to reproduce
✔️ Expected Behavior
The code block should be able to output more than a measly 80Kb (I hope!) to the next block.
❌ Actual Behavior
The code block task fails with the error: "The length of output variable
result
must be less than 80000 characters". That doesn’t make any sense. Nothing serious that can be done with just a negligible 80Kb output. Maybe it intended 80Mb? And an error made the limit be reduced by a factor of 10? Even so, it would be too limiting.