self.create_variable_message throws AttributeError #8

Closed
opened 2026-02-15 21:15:16 -05:00 by yindo · 1 comment
Owner

Originally created by @perzeuss on GitHub (Feb 25, 2025).

self.create_variable_message fails for yield self.create_variable_message("task_id", "1234")

Steps to reproduce:

  • Create a new tool plugin
  • Add this as first line of the _invoke function: self.create_variable_message("task_id", "1234")
  • Add the tool to a workflow and invoke it

Traceback (most recent call last):

  File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/core/server/io_server.py", line 92, in _execute_request_in_thread
    self._execute_request(
  File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/plugin.py", line 327, in _execute_request
    for message in response:
                   ^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 76, in invoke_tool
    yield from tool.invoke(request.tool_parameters)
  File "/workspaces/dify-new/dify-plugin-webhook/bugreprod/tools/bugreprod.py", line 9, in _invoke
    yield self.create_variable_message("task_id", "1234")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/interfaces/tool/__init__.py", line 82, in create_variable_message
    message=ToolInvokeMessage.VariableMessage(variable_name=variable_name, variable_value=variable_value),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/pydantic/main.py", line 193, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
  File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/entities/tool.py", line 99, in validate_variable_value_and_stream
    if values.get("stream") and not isinstance(v, str):
       ^^^^^^^^^^
AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'get'

Originally created by @perzeuss on GitHub (Feb 25, 2025). `self.create_variable_message` fails for `yield self.create_variable_message("task_id", "1234")` Steps to reproduce: - Create a new tool plugin - Add this as first line of the _invoke function: `self.create_variable_message("task_id", "1234")` - Add the tool to a workflow and invoke it Traceback (most recent call last): ``` File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/core/server/io_server.py", line 92, in _execute_request_in_thread self._execute_request( File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/plugin.py", line 327, in _execute_request for message in response: ^^^^^^^^ File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/core/plugin_executor.py", line 76, in invoke_tool yield from tool.invoke(request.tool_parameters) File "/workspaces/dify-new/dify-plugin-webhook/bugreprod/tools/bugreprod.py", line 9, in _invoke yield self.create_variable_message("task_id", "1234") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/interfaces/tool/__init__.py", line 82, in create_variable_message message=ToolInvokeMessage.VariableMessage(variable_name=variable_name, variable_value=variable_value), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vscode/.local/lib/python3.12/site-packages/pydantic/main.py", line 193, in __init__ self.__pydantic_validator__.validate_python(data, self_instance=self) File "/home/vscode/.local/lib/python3.12/site-packages/dify_plugin/entities/tool.py", line 99, in validate_variable_value_and_stream if values.get("stream") and not isinstance(v, str): ^^^^^^^^^^ AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'get' ```
yindo closed this issue 2026-02-15 21:15:16 -05:00
Author
Owner

@perzeuss commented on GitHub (Feb 25, 2025):

nvmd. the error has already been fixed, I still had an old version of the plugin installed.

@perzeuss commented on GitHub (Feb 25, 2025): nvmd. the error has already been fixed, I still had an old version of the plugin installed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-sdks#8