[PR #29056] fix: catch error in response converter #32279

Closed
opened 2026-02-21 20:51:06 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/29056

State: closed
Merged: Yes


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

When starting a workflow where some plugins are uninstalled, the workflow may stuck at the front-end.

The SSE breaks like following

截屏2025-12-03 12 01 09

The error message

2025-12-03 04:23:04.261 ERROR [GraphWorker-0] [node.py:329]  - Node 1764733967607 failed to run
Traceback (most recent call last):
  File "/app/api/core/workflow/nodes/base/node.py", line 319, in run
    for event in result:
                 ^^^^^^
  File "/app/api/core/workflow/nodes/tool/tool_node.py", line 77, in _run
    tool_runtime = ToolManager.get_workflow_tool_runtime(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 413, in get_workflow_tool_runtime
    tool_runtime = cls.get_tool_runtime(
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 180, in get_tool_runtime
    provider_controller = cls.get_builtin_provider(provider_id, tenant_id)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 109, in get_builtin_provider
    plugin_provider = cls.get_plugin_provider(provider, tenant_id)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 139, in get_plugin_provider
    provider_entity = manager.fetch_tool_provider(tenant_id, provider)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/plugin/impl/tool.py", line 67, in fetch_tool_provider
    response = self._request_with_plugin_daemon_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/plugin/impl/base.py", line 236, in _request_with_plugin_daemon_response
    self._handle_plugin_daemon_error(error.error_type, error.message)
  File "/app/api/core/plugin/impl/base.py", line 330, in _handle_plugin_daemon_error
    raise PluginNotFoundError(description=message)
core.plugin.impl.exc.PluginNotFoundError: req_id: bf8af248fe PluginNotFoundError: plugin not found
2025-12-03 04:23:04.295 INFO [Dummy-7] [_client.py:1038]  - HTTP Request: GET http://plugin_daemon:5002/plugin/d2da892c-9762-4058-b274-ee41054af743/management/tool?provider=tavily&plugin_id=langgenius%2Ftavily "HTTP/1.1 200 OK"
[2025-12-03 04:23:04 +0000] [48] [ERROR] Error handling request
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 114, in handle_request
    for item in respiter:
                ^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__
    return self._next()
           ^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded
    for item in iterable:
                ^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask/helpers.py", line 132, in generator
    yield from gen
  File "/app/api/libs/helper.py", line 218, in generate
    yield from response
  File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 120, in __next__
    return next(self.generator)
           ^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/app/apps/base_app_generator.py", line 189, in gen
    for message in generator:
                   ^^^^^^^^^
  File "/app/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 "/app/api/core/app/apps/workflow/generate_response_converter.py", line 46, in convert_stream_full_response
    for chunk in stream_response:
                 ^^^^^^^^^^^^^^^
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 167, in _to_stream_response
    for stream_response in generator:
                           ^^^^^^^^^
  File "/app/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 "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 612, in _process_stream_response
    if responses := list(
                    ^^^^^
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 539, in _dispatch_event
    yield from handler(
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 290, in _handle_node_started_event
    node_start_response = self._workflow_response_converter.workflow_node_start_to_stream_response(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/app/apps/common/workflow_response_converter.py", line 293, in workflow_node_start_to_stream_response
    response.data.extras["icon"] = ToolManager.get_tool_icon(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 969, in get_tool_icon
    provider = ToolManager.get_builtin_provider(provider_id, tenant_id)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 109, in get_builtin_provider
    plugin_provider = cls.get_plugin_provider(provider, tenant_id)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/tools/tool_manager.py", line 139, in get_plugin_provider
    provider_entity = manager.fetch_tool_provider(tenant_id, provider)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/plugin/impl/tool.py", line 67, in fetch_tool_provider
    response = self._request_with_plugin_daemon_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/plugin/impl/base.py", line 236, in _request_with_plugin_daemon_response
    self._handle_plugin_daemon_error(error.error_type, error.message)
  File "/app/api/core/plugin/impl/base.py", line 330, in _handle_plugin_daemon_error
    raise PluginNotFoundError(description=message)
core.plugin.impl.exc.PluginNotFoundError: <exception str() failed>
2025-12-03 04:23:04.300 ERROR [GraphDispatcher] [error_handler.py:101]  - Node 1764733967607 failed with ABORT strategy: req_id: bf8af248fe PluginNotFoundError: plugin not found
2025-12-03 04:23:04.369 ERROR [Thread-8 ( _generate_worker)] [workflow_entry.py:111]  - Unknown Error when workflow entry running
Traceback (most recent call last):
  File "/app/api/core/workflow/workflow_entry.py", line 107, in run
    yield from generator
  File "/app/api/core/workflow/graph_engine/graph_engine.py", line 270, in run
    raise self._graph_execution.error
RuntimeError: req_id: bf8af248fe PluginNotFoundError: plugin not found 

I'm not sure if this is related to #27997

Screenshots

Before After
image image image

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/29056 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary When starting a workflow where some plugins are uninstalled, the workflow may stuck at the front-end. The SSE breaks like following <img width="1133" height="152" alt="截屏2025-12-03 12 01 09" src="https://github.com/user-attachments/assets/61512805-5f67-4e4b-b069-6985d3cd39c3" /> The error message ``` 2025-12-03 04:23:04.261 ERROR [GraphWorker-0] [node.py:329] - Node 1764733967607 failed to run Traceback (most recent call last): File "/app/api/core/workflow/nodes/base/node.py", line 319, in run for event in result: ^^^^^^ File "/app/api/core/workflow/nodes/tool/tool_node.py", line 77, in _run tool_runtime = ToolManager.get_workflow_tool_runtime( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 413, in get_workflow_tool_runtime tool_runtime = cls.get_tool_runtime( ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 180, in get_tool_runtime provider_controller = cls.get_builtin_provider(provider_id, tenant_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 109, in get_builtin_provider plugin_provider = cls.get_plugin_provider(provider, tenant_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 139, in get_plugin_provider provider_entity = manager.fetch_tool_provider(tenant_id, provider) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/plugin/impl/tool.py", line 67, in fetch_tool_provider response = self._request_with_plugin_daemon_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/plugin/impl/base.py", line 236, in _request_with_plugin_daemon_response self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/impl/base.py", line 330, in _handle_plugin_daemon_error raise PluginNotFoundError(description=message) core.plugin.impl.exc.PluginNotFoundError: req_id: bf8af248fe PluginNotFoundError: plugin not found 2025-12-03 04:23:04.295 INFO [Dummy-7] [_client.py:1038] - HTTP Request: GET http://plugin_daemon:5002/plugin/d2da892c-9762-4058-b274-ee41054af743/management/tool?provider=tavily&plugin_id=langgenius%2Ftavily "HTTP/1.1 200 OK" [2025-12-03 04:23:04 +0000] [48] [ERROR] Error handling request Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 114, in handle_request for item in respiter: ^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__ return self._next() ^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded for item in iterable: ^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/helpers.py", line 132, in generator yield from gen File "/app/api/libs/helper.py", line 218, in generate yield from response File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 120, in __next__ return next(self.generator) ^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/base_app_generator.py", line 189, in gen for message in generator: ^^^^^^^^^ File "/app/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 "/app/api/core/app/apps/workflow/generate_response_converter.py", line 46, in convert_stream_full_response for chunk in stream_response: ^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 167, in _to_stream_response for stream_response in generator: ^^^^^^^^^ File "/app/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 "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 612, in _process_stream_response if responses := list( ^^^^^ File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 539, in _dispatch_event yield from handler( File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 290, in _handle_node_started_event node_start_response = self._workflow_response_converter.workflow_node_start_to_stream_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/common/workflow_response_converter.py", line 293, in workflow_node_start_to_stream_response response.data.extras["icon"] = ToolManager.get_tool_icon( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 969, in get_tool_icon provider = ToolManager.get_builtin_provider(provider_id, tenant_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 109, in get_builtin_provider plugin_provider = cls.get_plugin_provider(provider, tenant_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/tools/tool_manager.py", line 139, in get_plugin_provider provider_entity = manager.fetch_tool_provider(tenant_id, provider) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/plugin/impl/tool.py", line 67, in fetch_tool_provider response = self._request_with_plugin_daemon_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/plugin/impl/base.py", line 236, in _request_with_plugin_daemon_response self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/impl/base.py", line 330, in _handle_plugin_daemon_error raise PluginNotFoundError(description=message) core.plugin.impl.exc.PluginNotFoundError: <exception str() failed> 2025-12-03 04:23:04.300 ERROR [GraphDispatcher] [error_handler.py:101] - Node 1764733967607 failed with ABORT strategy: req_id: bf8af248fe PluginNotFoundError: plugin not found 2025-12-03 04:23:04.369 ERROR [Thread-8 ( _generate_worker)] [workflow_entry.py:111] - Unknown Error when workflow entry running Traceback (most recent call last): File "/app/api/core/workflow/workflow_entry.py", line 107, in run yield from generator File "/app/api/core/workflow/graph_engine/graph_engine.py", line 270, in run raise self._graph_execution.error RuntimeError: req_id: bf8af248fe PluginNotFoundError: plugin not found ``` I'm not sure if this is related to #27997 ## Screenshots | Before | After | |--------|-------| |<img width="395" height="226" alt="image" src="https://github.com/user-attachments/assets/3680e3ff-9645-4b31-85f8-0181b2193243" />| <img width="357" height="255" alt="image" src="https://github.com/user-attachments/assets/7f4a5465-144e-44d9-be80-0e6209988f37" /> <img width="378" height="297" alt="image" src="https://github.com/user-attachments/assets/68677086-b7af-4c21-9749-4ac90f512e84" />| ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:51:06 -05:00
yindo closed this issue 2026-02-21 20:51:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32279