Skip to content

fix(plugins): parse files when Dify already has an event loop - #3756

Merged
crazywoola merged 2 commits into
langgenius:mainfrom
Souravrajvi0:feat/fix-plugin-asyncio-loop-3732-fc6c
Aug 27, 2026
Merged

fix(plugins): parse files when Dify already has an event loop#3756
crazywoola merged 2 commits into
langgenius:mainfrom
Souravrajvi0:feat/fix-plugin-asyncio-loop-3732-fc6c

Conversation

@Souravrajvi0

@Souravrajvi0 Souravrajvi0 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #3732

Knowledge pipelines that pass multiple files into LlamaParse fail with a type-confusion error or an async warning, and the plugin often reports success while emitting the error as text. Unstructured Transform hits the same worker constraint: asyncio.run() cannot be called from a running event loop.

LlamaParse 0.0.9

  • Coerce each File.blob to bytes (bytearray / memoryview included) so load_data is not given a nested list or non-bytes payload
  • Wrap load_data with nest_asyncio so parsing works inside the gevent plugin daemon
  • Raise parse/download errors instead of yielding them as successful text output
  • Normalize a single file into a list so multi-file source nodes keep working

Unstructured Transform 0.0.11

  • Run _transform / credential checks through _run_coroutine(), which applies nest_asyncio before asyncio.run

Release Notes

  • Fix: LlamaParse now accepts multiple knowledge-pipeline files, coerces file bytes, and fails the node when parsing errors instead of returning them as success text.
  • Fix: Unstructured Transform no longer crashes with asyncio.run() cannot be called from a running event loop inside Dify workers.

LlamaParse failed on multiple knowledge-pipeline files because File.blob
was passed through uncoerced and parse errors were yielded as success.
Unstructured Transform called asyncio.run() inside the gevent worker loop.

Coerce each file to bytes, wrap LlamaParse load_data with nest_asyncio,
and run Unstructured Transform through the same nested-loop helper.

Fixes langgenius#3732
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Aug 26, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 27, 2026
@crazywoola
crazywoola deployed to tools/llama_parse August 27, 2026 01:55 — with GitHub Actions Active
@crazywoola
crazywoola deployed to tools/unstructured August 27, 2026 01:55 — with GitHub Actions Active
@crazywoola
crazywoola merged commit c62e9d4 into langgenius:main Aug 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LlamaParse plugin fails for when multiple input documents are present

2 participants