comfyUI node workflow cant run #291

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

Originally created by @Iassc4444 on GitHub (May 18, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

system remind me edit prompt part for {{positive_prompt}}, I have done it.
but new problem happened.

Failed to transform tool message: PluginInvokeError: {"args":{},"error_type":"UnboundLocalError","message":"cannot access local variable 'prompt' where it is not associated with a value"}

Image Image
Originally created by @Iassc4444 on GitHub (May 18, 2025). ### Self Checks - [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 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. ### Provide a description of requested docs changes system remind me edit prompt part for `{{positive_prompt}}`, I have done it. but new problem happened. Failed to transform tool message: PluginInvokeError: {"args":{},"error_type":"UnboundLocalError","message":"cannot access local variable 'prompt' where it is not associated with a value"} <img width="322" alt="Image" src="https://github.com/user-attachments/assets/ecc63dfa-4409-4fa7-9b29-1e91aceabb4d" /> <img width="317" alt="Image" src="https://github.com/user-attachments/assets/29e2d226-30c1-4e99-84f8-6663f3ebe8b0" />
yindo closed this issue 2026-02-16 10:18:49 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 18, 2025):

The error you're encountering, UnboundLocalError, typically occurs when a local variable is referenced before it has been assigned a value. In the context of the ComfyUI node workflow, this error suggests that the 'prompt' variable is being accessed without being properly initialized.

To resolve this issue, ensure that the 'prompt' variable is initialized with a non-empty string before it is used in the workflow. The ComfyUI node workflow requires the 'prompt' to be provided by the user. If the 'prompt' is not set, the system will prompt you to input a prompt. You can check the initialization of the 'prompt' in the _invoke method, which should look something like this:

prompt = tool_parameters.get("prompt", "")
if not prompt:
    return self.create_text_message("Please input prompt")

Make sure that the 'prompt' is correctly set in your workflow configuration. If you have modified the prompt part for {{positive_prompt}}, double-check that this variable is being correctly passed and initialized in your workflow setup [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (May 18, 2025): <!-- Answer --> The error you're encountering, `UnboundLocalError`, typically occurs when a local variable is referenced before it has been assigned a value. In the context of the ComfyUI node workflow, this error suggests that the 'prompt' variable is being accessed without being properly initialized. To resolve this issue, ensure that the 'prompt' variable is initialized with a non-empty string before it is used in the workflow. The ComfyUI node workflow requires the 'prompt' to be provided by the user. If the 'prompt' is not set, the system will prompt you to input a prompt. You can check the initialization of the 'prompt' in the `_invoke` method, which should look something like this: ```python prompt = tool_parameters.get("prompt", "") if not prompt: return self.create_text_message("Please input prompt") ``` Make sure that the 'prompt' is correctly set in your workflow configuration. If you have modified the prompt part for `{{positive_prompt}}`, double-check that this variable is being correctly passed and initialized in your workflow setup <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/comfyui/tools/comfyui_stable_diffusion.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/comfyui/tools/comfyui_client.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/30e162d4-7f5f-41ca-a79e-3a99464349e1?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/30e162d4-7f5f-41ca-a79e-3a99464349e1?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/30e162d4-7f5f-41ca-a79e-3a99464349e1?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/30e162d4-7f5f-41ca-a79e-3a99464349e1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/30e162d4-7f5f-41ca-a79e-3a99464349e1?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/30e162d4-7f5f-41ca-a79e-3a99464349e1?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/30e162d4-7f5f-41ca-a79e-3a99464349e1?feedback_type=other)</sup>
Author
Owner

@Noobzm commented on GitHub (May 22, 2025):

@Iassc4444
Have you solved your problem? I have encountered a similar issue:

Failed to transform tool message: PluginInvokeError: {"args":{},"error_type":"UnboundLocalError","message":"cannot access local variable 'ws' where it is not associated with a value"}

@Noobzm commented on GitHub (May 22, 2025): @Iassc4444 Have you solved your problem? I have encountered a similar issue: Failed to transform tool message: PluginInvokeError: {"args":{},"error_type":"UnboundLocalError","message":"cannot access local variable 'ws' where it is not associated with a value"}
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#291