dify - ✅(Solved) Fix import error cannot import name 'WeightedScoreConfig' from 'core.rag.entities' [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#34727Fetched 2026-04-09 08:18:06
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
1
Author
Assignees
Timeline (top)
assigned ×1closed ×1commented ×1cross-referenced ×1

Error Message

File "/Users/fatelei/dify/dify/api/core/workflow/nodes/knowledge_index/entities.py", line 7, in <module> from core.rag.entities import WeightedScoreConfig ImportError: cannot import name 'WeightedScoreConfig' from 'core.rag.entities' (/Users/fatelei/dify/dify/api/core/rag/entities/init.py)

Fix Action

Fixed

PR fix notes

PR #34728: fix: fix import error

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 #34727

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/core/workflow/nodes/knowledge_index/entities.py (modified, +1/-1)

Code Example

File "/Users/fatelei/dify/dify/api/core/workflow/nodes/knowledge_index/entities.py", line 7, in <module>
    from core.rag.entities import WeightedScoreConfig
ImportError: cannot import name 'WeightedScoreConfig' from 'core.rag.entities' (/Users/fatelei/dify/dify/api/core/rag/entities/__init__.py)
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.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. run workflow
  2. error is
File "/Users/fatelei/dify/dify/api/core/workflow/nodes/knowledge_index/entities.py", line 7, in <module>
    from core.rag.entities import WeightedScoreConfig
ImportError: cannot import name 'WeightedScoreConfig' from 'core.rag.entities' (/Users/fatelei/dify/dify/api/core/rag/entities/__init__.py)

✔️ Expected Behavior

no error

❌ Actual Behavior

File "/Users/fatelei/dify/dify/api/core/workflow/nodes/knowledge_index/entities.py", line 7, in <module> from core.rag.entities import WeightedScoreConfig ImportError: cannot import name 'WeightedScoreConfig' from 'core.rag.entities' (/Users/fatelei/dify/dify/api/core/rag/entities/init.py)

extent analysis

TL;DR

The issue can likely be resolved by updating the import statement in entities.py to match the actual location of WeightedScoreConfig or by ensuring that WeightedScoreConfig is correctly defined and exported in core.rag.entities.

Guidance

  • Verify that WeightedScoreConfig is defined in one of the files imported by core.rag.entities.__init__.py, and that it is correctly exported.
  • Check if there are any circular imports or missing __init__.py files in the core.rag.entities package that could be causing the import error.
  • If WeightedScoreConfig has been moved or renamed, update the import statement in entities.py to reflect the new location or name.
  • Consider checking the version history of the core.rag.entities module to see if WeightedScoreConfig was removed or renamed in a recent update.

Example

No code example is provided as the issue does not contain enough information to suggest a specific code change.

Notes

The issue may be specific to the self-hosted Docker setup, and it's unclear if this issue affects other environments. Additionally, without more information about the codebase and recent changes, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Update the import statement in entities.py to match the actual location of WeightedScoreConfig, or ensure that WeightedScoreConfig is correctly defined and exported in core.rag.entities. This is recommended because the issue appears to be related to a specific import error, and updating the import statement or ensuring correct exports may resolve the issue.

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