Skip to content

After workflow as tool add output_schema, the tool of generate file will make workflow unable to run #27598

Description

@CrabSAMA

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

In this pr: #26241

  1. create one workflow, which contain a tool of genearte file
  2. release it as tool
  3. create another workflow, which use tool before
  4. running blocked

✔️ Expected Behavior

Running successful

❌ Actual Behavior

Running blocked

Image

Error stack:

2025-10-29 06:45:53,720 INFO [_client.py:1038] 83e9574c72 HTTP Request: POST http://127.0.0.1:5002/plugin/b7df5634-8029-4c6d-969f-c39e9f7ae646/dispatch/tool/invoke "HTTP/1.1 200 OK"

[on_tool_execution]
Tool: md_to_pdf
Outputs: {"type":"blob","message":{"blob":"JVBERi0xLjQKJZOMi54gUmVwb3J0TGFiIEdlbmVyYXRlZCBQREYgZG9jdW1lbnQgaHR0cDovL3d3dy5yZXBvcnRsYWIuY29tCjEgMCBvYmoKPDwKL0YxIDIgMCBSIC9GMiAzIDAgUgo+PgplbmRvYmoKMiAwIG9iago8PAovQmFzZUZvbnQgL0hlbHZldGljYSAvRW5jb2RpbmcgL1dpbkFuc2lFbmNvZGluZyAvTmFtZSAvRjEgL1N1YnR5cGUgL1R5cGUxIC9UeXBlIC9Gb250Cj4+CmVuZG9iagozIDAgb2JqCjw8Ci9CYXNlRm9udCAvSGVsdmV0aWNhLUJvbGQgL0VuY29kaW5nIC9XaW5BbnNpRW5jb2RpbmcgL05hbWUgL0YyIC9TdWJ0eXBlIC9UeXBlMSAvVHlwZSAvRm9udAo+PgplbmRvYmoKNCAwIG9iago8PAovQ29udGVudHMgMTEgMCBSIC9NZWRpYUJveCBbIDAgMCA1OTUuMjc1NiA4NDEuODg5OCBdIC9QYXJlbnQgMTAgMCBSIC9SZXNvdXJjZXMgPDwKL0ZvbnQgMSAwIFIgL1Byb2NTZXQgWyAvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJIF0KPj4gL1JvdGF0ZSAwIC9UcmFucyA8PAoKPj4gCiAgL1R5cGUgL1BhZ2UKPj4KZW5kb2JqCjUgMCBvYmoKPDwKL091dGxpbmVzIDcgMCBSIC9QYWdlTW9kZSAvVXNlTm9uZSAvUGFnZXMgMTAgMCBSIC9UeXBlIC9DYXRhbG9nCj4+CmVuZG9iago2IDAgb2JqCjw8Ci9BdXRob3IgKCkgL0NyZWF0aW9uRGF0ZSAoRDoyMDI1MTAyOTA2NDU1MyswMCcwMCcpIC9DcmVhdG9yIChcKHVuc3BlY2lmaWVkXCkpIC9LZXl3b3JkcyAoKS


[on_tool_execution]
Tool: test
Outputs: {"type":"file","message":{},"meta":{"file":{"dify_model_identity":"__dify__file__","id":null,"tenant_id":"b7df5634-8029-4c6d-969f-c39e9f7ae646","type":"document","transfer_method":"tool_file","remote_url":null,"related_id":"920ca321-903e-4926-9a7f-63058b474e65","filename":"dd0f91f600dd4bb9aef13787858739d2.pdf","extension":".pdf","mime_type":"application/pdf","size":1954}}}


[on_tool_execution]
Tool: test
Outputs: {"type":"variable","message":{"variable_name":"files1","variable_value":[{"dify_model_identity":"__dify__file__","id":null,"tenant_id":"b7df5634-8029-4c6d-969f-c39e9f7ae646","type":"document","transfer_method":"tool_file","remote_url":null,"related_id":"920ca321-903e-4926-9a7f-63058b474e65","filename":"dd0f91f600dd4bb9aef13787858739d2.pdf","extension":".pdf","mime_type":"application/pdf","size":1954,"url":"http://127.0.0.1:5001/files/tools/920ca321-903e-4926-9a7f-63058b474e65.pdf?timestamp=1761720353&nonce=e64f5429db30981f3d25f204844968d4&sign=QO_ABnubsyWzC6DB2_D0BvtK7qK1ZWaiKkhxx6cZclU=","tool_file_id":"920ca321-903e-4926-9a7f-63058b474e65"}],"stream":false},"meta":null}


[on_tool_execution]
Tool: test
Outputs: {"type":"text","message":{"text":"{\"files1\": [{\"dify_model_identity\": \"__dify__file__\", \"id\": null, \"tenant_id\": \"b7df5634-8029-4c6d-969f-c39e9f7ae646\", \"type\": \"document\", \"transfer_method\": \"tool_file\", \"remote_url\": null, \"related_id\": \"920ca321-903e-4926-9a7f-63058b474e65\", \"filename\": \"dd0f91f600dd4bb9aef13787858739d2.pdf\", \"extension\": \".pdf\", \"mime_type\": \"application/pdf\", \"size\": 1954, \"url\": \"http://127.0.0.1:5001/files/tools/920ca321-903e-4926-9a7f-63058b474e65.pdf?timestamp=1761720353&nonce=e64f5429db30981f3d25f204844968d4&sign=QO_ABnubsyWzC6DB2_D0BvtK7qK1ZWaiKkhxx6cZclU=\", \"tool_file_id\": \"920ca321-903e-4926-9a7f-63058b474e65\"}]}"},"meta":null}


[on_tool_execution]
Tool: test
Outputs: {"type":"json","message":{"json_object":{"files1":[{"dify_model_identity":"__dify__file__","id":null,"tenant_id":"b7df5634-8029-4c6d-969f-c39e9f7ae646","type":"document","transfer_method":"tool_file","remote_url":null,"related_id":"920ca321-903e-4926-9a7f-63058b474e65","filename":"dd0f91f600dd4bb9aef13787858739d2.pdf","extension":".pdf","mime_type":"application/pdf","size":1954,"url":"http://127.0.0.1:5001/files/tools/920ca321-903e-4926-9a7f-63058b474e65.pdf?timestamp=1761720353&nonce=e64f5429db30981f3d25f204844968d4&sign=QO_ABnubsyWzC6DB2_D0BvtK7qK1ZWaiKkhxx6cZclU=","tool_file_id":"920ca321-903e-4926-9a7f-63058b474e65"}]}},"meta":null}

Debugging middleware caught exception in streamed response at a point where response headers were already sent.
Traceback (most recent call last):
  File "/Users/crab.huang/Project/opensource/dify/api/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__
    return self._next()
           ^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded
    for item in iterable:
                ^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/.venv/lib/python3.12/site-packages/flask/helpers.py", line 132, in generator
    yield from gen
  File "/Users/crab.huang/Project/opensource/dify/api/libs/helper.py", line 209, in generate
    yield from response
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/features/rate_limiting/rate_limit.py", line 120, in __next__
    return next(self.generator)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/base_app_generator.py", line 176, in gen
    for message in generator:
                   ^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/base_app_generate_response_converter.py", line 27, in _generate_full_response
    yield from cls.convert_stream_full_response(response)
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/workflow/generate_response_converter.py", line 46, in convert_stream_full_response
    for chunk in stream_response:
                 ^^^^^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/workflow/generate_task_pipeline.py", line 167, in _to_stream_response
    for stream_response in generator:
                           ^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/workflow/generate_task_pipeline.py", line 198, in _wrapper_process_stream_response
    for response in self._process_stream_response(tts_publisher=tts_publisher, trace_manager=trace_manager):
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/workflow/generate_task_pipeline.py", line 619, in _process_stream_response
    if responses := list(
                    ^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/workflow/generate_task_pipeline.py", line 546, in _dispatch_event
    yield from handler(
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/workflow/generate_task_pipeline.py", line 303, in _handle_node_succeeded_event
    self._save_output_for_event(event, event.node_execution_id)
  File "/Users/crab.huang/Project/opensource/dify/api/core/app/apps/workflow/generate_task_pipeline.py", line 684, in _save_output_for_event
    saver.save(event.process_data, event.outputs)
  File "/Users/crab.huang/Project/opensource/dify/api/services/workflow_draft_variable_service.py", line 1032, in save
    draft_vars = self._build_variables_from_mapping(outputs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/services/workflow_draft_variable_service.py", line 886, in _build_variables_from_mapping
    value_seg = _build_segment_for_serialized_values(value)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/services/workflow_draft_variable_service.py", line 693, in _build_segment_for_serialized_values
    return build_segment(WorkflowDraftVariable.rebuild_file_types(v))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/models/workflow.py", line 1319, in rebuild_file_types
    file_list: list[File] = [File.model_validate(cast(dict[str, Any], i)) for i in value_list]
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/crab.huang/Project/opensource/dify/api/.venv/lib/python3.12/site-packages/pydantic/main.py", line 705, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: File.__init__() got an unexpected keyword argument 'tool_file_id'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

🐞 bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions