[Bug] Knowledge Retrieval node fails with "metadata_model_config is required" when using manual metadata filtering #22240

Open
opened 2026-02-21 20:16:16 -05:00 by yindo · 0 comments
Owner

Originally created by @miyarappo on GitHub (Feb 17, 2026).

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

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a workflow with a Knowledge Retrieval node in Dify <= 1.11.1
  2. Set metadata filtering mode to "manual" and configure filter conditions
  3. Confirm the workflow works correctly in 1.11.1
  4. Upgrade Dify to 1.13.0
  5. Run the same workflow

The Knowledge Retrieval node fails with:

metadata_model_config is required for this method

✔️ Expected Behavior

Knowledge Retrieval node with manual metadata filtering should work without requiring metadata_model_config, as it was in 1.11.1.

Actual Behavior

Knowledge Retrieval node fails with metadata_model_config is required for this method even when metadata filtering is set to manual mode.

Root cause:
PR #31981 (merged 2026-02-09) introduced a new knowledge_retrieval method in api/core/rag/retrieval/dataset_retrieval.py. This method checks metadata_model_config for all non-disabled metadata filtering modes:

if request.metadata_filtering_mode != "disabled":
    if not request.metadata_model_config:
        raise ValueError("metadata_model_config is required for this method")

However, manual mode does not use metadata_model_config — only automatic mode does (for LLM-based filter generation). In the previous implementation (retrieve method in 1.11.1), the metadata_model_config check was correctly placed only inside the automatic branch of get_metadata_filter_condition.

Additionally, there is no UI field to set metadata_model_config when using manual mode, so it is always None.

Suggested fix:
Move the metadata_model_config check inside the automatic mode branch, or skip it for manual mode:

if request.metadata_filtering_mode != "disabled":
    if request.metadata_filtering_mode == "automatic" and not request.metadata_model_config:
        raise ValueError("metadata_model_config is required for this method")
Originally created by @miyarappo on GitHub (Feb 17, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.13.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Create a workflow with a Knowledge Retrieval node in Dify <= 1.11.1 2. Set metadata filtering mode to "manual" and configure filter conditions 3. Confirm the workflow works correctly in 1.11.1 4. Upgrade Dify to 1.13.0 5. Run the same workflow The Knowledge Retrieval node fails with: ``` metadata_model_config is required for this method ``` ### ✔️ Expected Behavior Knowledge Retrieval node with manual metadata filtering should work without requiring metadata_model_config, as it was in 1.11.1. ### ❌ Actual Behavior Knowledge Retrieval node fails with metadata_model_config is required for this method even when metadata filtering is set to manual mode. Root cause: PR #31981 (merged 2026-02-09) introduced a new knowledge_retrieval method in api/core/rag/retrieval/dataset_retrieval.py. This method checks metadata_model_config for all non-disabled metadata filtering modes: ```python if request.metadata_filtering_mode != "disabled": if not request.metadata_model_config: raise ValueError("metadata_model_config is required for this method") ``` However, manual mode does not use metadata_model_config — only automatic mode does (for LLM-based filter generation). In the previous implementation (retrieve method in 1.11.1), the metadata_model_config check was correctly placed only inside the automatic branch of get_metadata_filter_condition. Additionally, there is no UI field to set metadata_model_config when using manual mode, so it is always None. Suggested fix: Move the metadata_model_config check inside the automatic mode branch, or skip it for manual mode: ```python if request.metadata_filtering_mode != "disabled": if request.metadata_filtering_mode == "automatic" and not request.metadata_model_config: raise ValueError("metadata_model_config is required for this method") ```
yindo added the 🐞 bug label 2026-02-21 20:16:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22240