Parent-child full-doc mode raises IndexError when extraction yields zero documents
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in api/core/rag/index_processor/processor/parent_child_index_processor.py, in transform(), at the FULL_DOC branch near line 119 where documents[0].metadata is read without a check. Compare with the zero-chunk guard that PR #45089 added to the QA processor, and with how paragraph mode returns no chunks for empty input. Done when transform([]) in full-doc mode returns no chunks and does not raise, and the parent-child processor tests pass.
Written by the indexing model from the issue text.
Description
Self Checks
- This is a bug report, not a feature request
- I have searched the existing issues
Description
ParentChildIndexProcessor.transform() crashes with IndexError: list index out of range when parent mode is FULL_DOC and extraction yields zero documents (e.g. an empty Notion page or an empty URL fetch - both legitimately return []):
# api/core/rag/index_processor/processor/parent_child_index_processor.py, FULL_DOC branch
document = Document(page_content=page_content, metadata=documents[0].metadata) # line 119, unguarded
Impact: the indexing-estimate endpoint fails with a 500-style "list index out of range", and real indexing marks the document failed. Paragraph mode handles the same input correctly by producing zero chunks; only the full-doc branch is affected.
This is the exact sibling of #45087 (zero QA chunks -> IndexError -> HTTP 500), which was fixed for the QA processor in #45089 - the parent-child full-doc branch was missed.
Reproduction
- Create a knowledge base with a parent-child indexing technique in full-doc parent mode.
- Add a source that extracts zero documents (empty Notion page / URL that returns empty content).
- Estimate or index:
ParentChildIndexProcessor.transform([], ...)raisesIndexErroratparent_child_index_processor.py:119.
Expected: no chunks, same as paragraph mode. Actual: IndexError.
Environment
- Dify main @ a79e2116
- OS: any (not platform-specific)
- Dominant language
- Python
- Stars
- 160k
- Forks
- 25.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 608
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from langgenius/dify
-
Custom API tool sends unset optional header and cookie parameters as empty values or "None"Possibly taken @TemitopeKadri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
langgenius/dify#46010 · 1 reaction ·
Maintainers usually reply within 1 day
-
Detail sidebar collapse drops keyboard focusPossibly taken @GYJ99 claimed this 1 day ago. Openproject#dify
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
langgenius/dify#45934 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
[Bug] CotAgentOutputParser overwrites action_name with non-input keys and collapses multi-block code fencesPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
langgenius/dify#45324 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Chore/Refactor] bring jieba keyword table handler tests under strict pyreflyMay be free again @Luckyou-d claimed this 7 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
langgenius/dify#45319 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] Agent resource access page loses its sidebar on refreshPossibly taken @XiaoBa-Yu claimed this 8 days ago. Open1.18.0
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
langgenius/dify#45291 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
With emit_ontology_keys, one ontology key change is reported as two errors (keys and keys_digest)Possibly taken @rvandewater claimed this today. Openbug priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
iausathub/satchecker#286 ·
Maintainers usually reply within 1 day
-
bug test
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenAssetIO/OpenAssetIO#1527 ·
-
automated endpoint-dead needs-curation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
almanac-data/climate-almanac#128 ·
Maintainers usually reply within 1 day