After updating to the latest version, the boolean variable at the end node has been changed to a numeric variable. #4928

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

Originally created by @nancat6 on GitHub (Aug 7, 2024).

Originally assigned to: @laipz8200 on GitHub.

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.6.16

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

After updating to the latest version, the boolean variable at the end node has been changed to a numeric variable.
old
new
The result variable has been coerced from a boolean type to a numeric type.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @nancat6 on GitHub (Aug 7, 2024). Originally assigned to: @laipz8200 on GitHub. ### 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.6.16 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce After updating to the latest version, the boolean variable at the end node has been changed to a numeric variable. ![old](https://github.com/user-attachments/assets/df1f8560-5071-4ef6-9474-e6f70c3a5c74) ![new](https://github.com/user-attachments/assets/b6c67480-428f-451d-add0-ae49e3473d5b) The `result` variable has been coerced from a boolean type to a numeric type. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:08:39 -05:00
yindo closed this issue 2026-02-21 18:08:39 -05:00
Author
Owner

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

@nancat6 Hello there! I'm a bot designed to help you solve bugs, answer questions, and become a contributor. I'm here to assist you while waiting for a human maintainer.

The result variable has been changed from a boolean type to a numeric type in version 0.6.16 because the current version does not support boolean types. This is indicated by the commented-out code in the _transform_result method:

# TODO: bool is not supported in the current version
# elif parameter.type == 'bool':
#     if isinstance(result[parameter.name], bool):
#         transformed_result[parameter.name] = bool(result[parameter.name])
#     elif isinstance(result[parameter.name], str):
#         if result[parameter.name].lower() in ['true', 'false']:
#             transformed_result[parameter.name] = bool(result[parameter.name].lower() == 'true')
#     elif isinstance(result[parameter.name], int):
#         transformed_result[parameter.name] = bool(result[parameter.name])

Additionally, the integration tests for the CodeNode class in the test_code.py file show that the result variable is expected to be of type number or string, but not boolean [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 7, 2024): <!-- Greeting --> @nancat6 Hello there! I'm a bot designed to help you solve bugs, answer questions, and become a contributor. I'm here to assist you while waiting for a human maintainer. <!-- Answer --> The `result` variable has been changed from a boolean type to a numeric type in version 0.6.16 because the current version does not support boolean types. This is indicated by the commented-out code in the `_transform_result` method: ```python # TODO: bool is not supported in the current version # elif parameter.type == 'bool': # if isinstance(result[parameter.name], bool): # transformed_result[parameter.name] = bool(result[parameter.name]) # elif isinstance(result[parameter.name], str): # if result[parameter.name].lower() in ['true', 'false']: # transformed_result[parameter.name] = bool(result[parameter.name].lower() == 'true') # elif isinstance(result[parameter.name], int): # transformed_result[parameter.name] = bool(result[parameter.name]) ``` Additionally, the integration tests for the `CodeNode` class in the `test_code.py` file show that the `result` variable is expected to be of type `number` or `string`, but not `boolean` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/tests/integration_tests/workflow/nodes/test_code.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4928