Self Checks
Dify version
1.4.1
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
Description
After removing a knowledge base from a Knowledge Retrieval workflow node, the node settings panel can look correct, but the workflow canvas may still show a ghost entry — an icon with no dataset name (blank label).
This can also appear when:
A dataset is removed from the node (or no longer exists).
The workflow canvas looks fine when opened from outside.
The user adds another knowledge base — the blank icon reappears alongside valid datasets.
Steps to reproduce
Create a workflow with a Knowledge Retrieval node.
Add one or more knowledge bases to the node and save the workflow.
Remove a knowledge base from the node (or delete it so it no longer exists).
Observe: Settings may show only remaining datasets; canvas may still show a blank icon row.
Optional: close the node panel, open the workflow again (may look OK briefly), then add another knowledge base — blank icon appears again.
Root cause (technical summary)
Several layers get out of sync:
dataset_ids not pruned on load — use-knowledge-dataset-selection.ts fetches dataset details but writes back the original dataset_ids array even when the API no longer returns deleted IDs.
Panel vs canvas mismatch — use-config.ts exposes selectedDatasets.filter(d => d.name) to the panel, but node.tsx renders from dataset_ids + datasetsDetail without the same filter.
Dataset picker stubs — select-dataset/index.tsx uses datasetMap.get(id) || ({ id } as DataSet), so missing datasets become nameless placeholders.
Stale cache — datasets-detail-store only merges new entries; it does not remove IDs that were deleted or invalid.
Add flow uses raw inputs.dataset_ids — panel.tsx passes selectedIds={inputs.dataset_ids} to the add-dataset modal, so ghost IDs can be carried into the next selection.
Proposed fix direction
On load: set dataset_ids to IDs returned by the API only; sync/remove stale entries from datasetsDetail.
On change: filter datasets to those with valid name before updating dataset_ids and cache.
Canvas: only render datasets that have a name.
Select modal: resolve IDs via datasetMap only; do not submit { id } stubs; use current valid selection IDs when opening the add modal.
Store: add sync/prune for requested IDs that are no longer returned by the API.
✔️ Expected Behavior
Expected behavior
Removed or non-existent datasets should not appear on the node on the canvas.
dataset_ids in node data should stay in sync with datasets that actually exist.
Adding a new dataset should not resurrect stale IDs.
❌ Actual Behavior
Actual behavior
Settings/list UI may only show valid datasets (entries without name are filtered in the panel).
The canvas node still renders entries from dataset_ids + datasetsDetail cache, including stale or placeholder datasets.
The dataset selector can pass stub objects { id } when an ID is not found in the list, which produces an icon with no name.
Self Checks
Dify version
1.4.1
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
Description
After removing a knowledge base from a Knowledge Retrieval workflow node, the node settings panel can look correct, but the workflow canvas may still show a ghost entry — an icon with no dataset name (blank label).
This can also appear when:
A dataset is removed from the node (or no longer exists).
The workflow canvas looks fine when opened from outside.
The user adds another knowledge base — the blank icon reappears alongside valid datasets.
Steps to reproduce
Create a workflow with a Knowledge Retrieval node.
Add one or more knowledge bases to the node and save the workflow.
Remove a knowledge base from the node (or delete it so it no longer exists).
Observe: Settings may show only remaining datasets; canvas may still show a blank icon row.
Optional: close the node panel, open the workflow again (may look OK briefly), then add another knowledge base — blank icon appears again.
Root cause (technical summary)
Several layers get out of sync:
dataset_ids not pruned on load — use-knowledge-dataset-selection.ts fetches dataset details but writes back the original dataset_ids array even when the API no longer returns deleted IDs.
Panel vs canvas mismatch — use-config.ts exposes selectedDatasets.filter(d => d.name) to the panel, but node.tsx renders from dataset_ids + datasetsDetail without the same filter.
Dataset picker stubs — select-dataset/index.tsx uses datasetMap.get(id) || ({ id } as DataSet), so missing datasets become nameless placeholders.
Stale cache — datasets-detail-store only merges new entries; it does not remove IDs that were deleted or invalid.
Add flow uses raw inputs.dataset_ids — panel.tsx passes selectedIds={inputs.dataset_ids} to the add-dataset modal, so ghost IDs can be carried into the next selection.
Proposed fix direction
On load: set dataset_ids to IDs returned by the API only; sync/remove stale entries from datasetsDetail.
On change: filter datasets to those with valid name before updating dataset_ids and cache.
Canvas: only render datasets that have a name.
Select modal: resolve IDs via datasetMap only; do not submit { id } stubs; use current valid selection IDs when opening the add modal.
Store: add sync/prune for requested IDs that are no longer returned by the API.
✔️ Expected Behavior
Expected behavior
Removed or non-existent datasets should not appear on the node on the canvas.
dataset_ids in node data should stay in sync with datasets that actually exist.
Adding a new dataset should not resurrect stale IDs.
❌ Actual Behavior
Actual behavior
Settings/list UI may only show valid datasets (entries without name are filtered in the panel).
The canvas node still renders entries from dataset_ids + datasetsDetail cache, including stale or placeholder datasets.
The dataset selector can pass stub objects { id } when an ID is not found in the list, which produces an icon with no name.