dify - ✅(Solved) Fix The knowledge base cannot be used after OpenSearch is used. [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#34732Fetched 2026-04-09 08:18:02
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
1
Author
Participants
Timeline (top)
commented ×1cross-referenced ×1labeled ×1

Error Message

An error is reported when the knowledge base is used. The error information is as follows:

Fix Action

Fixed

PR fix notes

PR #34792: chore: rename events package avoid import conflict in opensearch

Description (problem / solution / changelog)

[!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

fix #34732

Screenshots

BeforeAfter
......

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 make lint and make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

Changed files

  • api/commands/system.py (modified, +1/-1)
  • api/configs/extra/sentry_config.py (modified, +1/-1)
  • api/configs/middleware/cache/redis_pubsub_config.py (modified, +1/-1)
  • api/controllers/console/app/model_config.py (modified, +1/-1)
  • api/controllers/console/app/workflow.py (modified, +7/-7)
  • api/controllers/console/auth/forgot_password.py (modified, +1/-1)
  • api/controllers/console/auth/login.py (modified, +1/-1)
  • api/controllers/console/auth/oauth.py (modified, +1/-1)
  • api/controllers/console/human_input_form.py (modified, +3/-3)
  • api/controllers/inner_api/workspace/workspace.py (modified, +1/-1)
  • api/controllers/web/workflow_events.py (modified, +4/-4)
  • api/core/app/apps/advanced_chat/generate_task_pipeline.py (modified, +37/-37)
  • api/core/app/apps/common/workflow_response_converter.py (modified, +3/-3)
  • api/core/app/apps/workflow/generate_task_pipeline.py (modified, +32/-32)
  • api/core/app/layers/conversation_variable_persist_layer.py (modified, +2/-2)
  • api/core/app/layers/pause_state_persist_layer.py (modified, +5/-5)
  • api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py (modified, +1/-1)
  • api/core/mcp/client/sse_client.py (modified, +3/-3)
  • api/core/mcp/utils.py (modified, +1/-1)
  • api/core/plugin/impl/trigger.py (modified, +2/-2)
  • api/core/telemetry/__init__.py (modified, +1/-1)
  • api/core/telemetry/gateway.py (modified, +3/-3)
  • api/core/trigger/debug/event_selectors.py (modified, +1/-1)
  • api/core/trigger/debug/events.py (modified, +3/-3)
  • api/core/trigger/entities/api_entities.py (modified, +1/-1)
  • api/core/trigger/entities/entities.py (modified, +2/-2)
  • api/core/trigger/provider.py (modified, +1/-1)
  • api/core/workflow/nodes/trigger_plugin/trigger_event_node.py (modified, +1/-1)
  • api/enterprise/telemetry/contracts.py (modified, +2/-2)
  • api/enterprise/telemetry/enterprise_trace.py (modified, +1/-1)
  • api/enterprise/telemetry/event_handlers.py (modified, +1/-1)
  • api/enterprise/telemetry/metric_handler.py (modified, +3/-3)
  • api/enterprise/telemetry/telemetry_log.py (modified, +2/-2)
  • api/extensions/ext_import_modules.py (modified, +1/-1)
  • api/extensions/otel/instrumentation.py (modified, +1/-1)
  • api/gunicorn.conf.py (modified, +3/-3)
  • api/message_events/__init__.py (renamed, +0/-0)
  • api/message_events/app_event.py (renamed, +0/-0)
  • api/message_events/dataset_event.py (renamed, +0/-0)
  • api/message_events/document_event.py (renamed, +0/-0)
  • api/message_events/document_index_event.py (renamed, +0/-0)
  • api/message_events/event_handlers/__init__.py (renamed, +0/-0)
  • api/message_events/event_handlers/clean_when_dataset_deleted.py (renamed, +1/-1)
  • api/message_events/event_handlers/clean_when_document_deleted.py (renamed, +1/-1)
  • api/message_events/event_handlers/create_document_index.py (renamed, +1/-1)
  • api/message_events/event_handlers/create_installed_app_when_app_created.py (renamed, +1/-1)
  • api/message_events/event_handlers/create_site_record_when_app_created.py (renamed, +1/-1)
  • api/message_events/event_handlers/delete_tool_parameters_cache_when_sync_draft_workflow.py (renamed, +1/-1)
  • api/message_events/event_handlers/queue_credential_sync_when_tenant_created.py (renamed, +1/-1)
  • api/message_events/event_handlers/sync_plugin_trigger_when_app_created.py (renamed, +1/-1)
  • api/message_events/event_handlers/sync_webhook_when_app_created.py (renamed, +1/-1)
  • api/message_events/event_handlers/sync_workflow_schedule_when_app_published.py (renamed, +1/-1)
  • api/message_events/event_handlers/update_app_dataset_join_when_app_model_config_updated.py (renamed, +1/-1)
  • api/message_events/event_handlers/update_app_dataset_join_when_app_published_workflow_updated.py (renamed, +1/-1)
  • api/message_events/event_handlers/update_app_triggers_when_app_published_workflow_updated.py (renamed, +1/-1)
  • api/message_events/event_handlers/update_provider_when_message_created.py (renamed, +1/-1)
  • api/message_events/message_event.py (renamed, +0/-0)
  • api/message_events/tenant_event.py (renamed, +0/-0)
  • api/repositories/api_workflow_node_execution_repository.py (modified, +1/-1)
  • api/services/account_service.py (modified, +1/-1)
  • api/services/app_dsl_service.py (modified, +1/-1)
  • api/services/app_generate_service.py (modified, +2/-2)
  • api/services/app_service.py (modified, +1/-1)
  • api/services/dataset_service.py (modified, +2/-2)
  • api/services/end_user_service.py (modified, +1/-1)
  • api/services/rag_pipeline/rag_pipeline.py (modified, +1/-1)
  • api/services/workflow/workflow_converter.py (modified, +1/-1)
  • api/services/workflow_event_snapshot_service.py (modified, +2/-2)
  • api/services/workflow_service.py (modified, +3/-3)
  • api/tasks/enterprise_telemetry_task.py (modified, +2/-2)
  • api/tasks/trigger_processing_tasks.py (modified, +1/-1)
  • api/tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py (modified, +4/-4)
  • api/tests/test_containers_integration_tests/services/dataset_service_update_delete.py (modified, +1/-1)
  • api/tests/test_containers_integration_tests/services/test_dataset_service_delete_dataset.py (modified, +5/-5)
  • api/tests/test_containers_integration_tests/trigger/test_trigger_e2e.py (modified, +7/-7)
  • api/tests/unit_tests/controllers/console/test_human_input_form.py (modified, +4/-4)
  • api/tests/unit_tests/controllers/web/test_workflow_events.py (modified, +5/-5)
  • api/tests/unit_tests/core/app/apps/chat/test_base_app_runner_multimodal.py (modified, +1/-1)
  • api/tests/unit_tests/core/app/apps/common/test_workflow_response_converter_truncation.py (modified, +6/-6)
  • api/tests/unit_tests/core/app/layers/test_pause_state_persist_layer.py (modified, +1/-1)
  • api/tests/unit_tests/core/app/task_pipeline/test_easy_ui_based_generate_task_pipeline.py (modified, +8/-8)
  • api/tests/unit_tests/core/app/task_pipeline/test_message_cycle_manager_optimization.py (modified, +1/-1)
  • api/tests/unit_tests/core/mcp/client/test_sse.py (modified, +2/-2)
  • api/tests/unit_tests/core/plugin/impl/test_trigger_client.py (modified, +10/-5)
  • api/tests/unit_tests/core/tools/utils/test_tool_engine_serialization.py (modified, +1/-1)
  • api/tests/unit_tests/core/workflow/graph_engine/test_table_runner.py (modified, +5/-5)
  • api/tests/unit_tests/core/workflow/graph_engine/test_tool_in_chatflow.py (modified, +1/-1)
  • api/tests/unit_tests/core/workflow/test_workflow_entry_redis_channel.py (modified, +2/-2)
  • api/tests/unit_tests/events/test_app_event_signals.py (modified, +9/-9)
  • api/tests/unit_tests/extensions/otel/decorators/test_base.py (modified, +1/-1)
  • api/tests/unit_tests/services/rag_pipeline/test_pipeline_generate_service.py (modified, +3/-3)
  • api/tests/unit_tests/services/test_app_generate_service_streaming_integration.py (modified, +4/-4)
  • api/tests/unit_tests/services/test_schedule_service.py (modified, +20/-14)
  • api/tests/unit_tests/services/test_workflow_service.py (modified, +1/-1)
RAW_BUFFERClick to expand / collapse

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.13.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

An error is reported when the knowledge base is used. The error information is as follows: worker-1 | File "/app/api/core/rag/datasource/vdb/vector_factory.py", line 135, in get_vector_factory worker-1 | from core.rag.datasource.vdb.opensearch.opensearch_vector import OpenSearchVectorFactory worker-1 | File "/app/api/core/rag/datasource/vdb/opensearch/opensearch_vector.py", line 6, in worker-1 | from opensearchpy import OpenSearch, Urllib3AWSV4SignerAuth, Urllib3HttpConnection, helpers worker-1 | File "/app/api/.venv/lib/python3.12/site-packages/opensearchpy/init.py", line 45, in worker-1 | from .client import OpenSearch worker-1 | File "/app/api/.venv/lib/python3.12/site-packages/opensearchpy/client/init.py", line 40, in worker-1 | from ..transport import Transport, TransportError worker-1 | File "/app/api/.venv/lib/python3.12/site-packages/opensearchpy/transport.py", line 32, in worker-1 | from opensearchpy.metrics import Metrics, MetricsNone worker-1 | File "/app/api/.venv/lib/python3.12/site-packages/opensearchpy/metrics/init.py", line 11, in worker-1 | from .metrics_events import MetricsEvents worker-1 | File "/app/api/.venv/lib/python3.12/site-packages/opensearchpy/metrics/metrics_events.py", line 13, in worker-1 | from events import Events worker-1 | ImportError: cannot import name 'Events' from 'events' (/app/api/events/init.py)

✔️ Expected Behavior

The knowledge base is running properly.

❌ Actual Behavior

The knowledge base cannot be used.

extent analysis

TL;DR

The most likely fix is to resolve the import error by checking the compatibility of the opensearchpy library with the current Python version.

Guidance

  • Verify that the opensearchpy library is compatible with Python 3.12, as the error occurs during the import of its modules.
  • Check the events module for any naming conflicts or incorrect imports that could cause the ImportError.
  • Review the opensearchpy documentation for any specific installation or configuration requirements for Python 3.12.
  • Consider testing the application with a previous version of Python to isolate the issue.

Notes

The error message suggests a compatibility issue between the opensearchpy library and Python 3.12. However, without more information about the library's version or the application's configuration, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Check the compatibility of the opensearchpy library with Python 3.12 and consider downgrading to a compatible Python version if necessary.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING