Space between words get removed in child chunk - Knowledge Pipeline with Parent Chunk Mode #22127

Open
opened 2026-02-21 20:15:53 -05:00 by yindo · 1 comment
Owner

Originally created by @img88-nds on GitHub (Feb 6, 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.12.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Create Knowledge Pipeline with Parent Chunk Mode

✔️ Expected Behavior

Space between words in the child chunk is not removed

Actual Behavior

Sometimes the child chunk removes the space between words.

Doc Extractor Result
doc_extractor_result.txt

Parent Child Chunker Result

parent_child_chunk_result.txt

Normal Chunk and Wrong Chunk in one result

Image
Originally created by @img88-nds on GitHub (Feb 6, 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.12.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Create Knowledge Pipeline with Parent Chunk Mode ### ✔️ Expected Behavior Space between words in the child chunk is not removed ### ❌ Actual Behavior Sometimes the child chunk removes the space between words. Doc Extractor Result [doc_extractor_result.txt](https://github.com/user-attachments/files/25125289/doc_extractor_result.txt) Parent Child Chunker Result [parent_child_chunk_result.txt](https://github.com/user-attachments/files/25125308/parent_child_chunk_result.txt) Normal Chunk and Wrong Chunk in one result <img width="580" height="865" alt="Image" src="https://github.com/user-attachments/assets/724ba067-3c55-4a1c-b3c7-c99af7b0a7cd" />
yindo added the 🐞 bug label 2026-02-21 20:15:53 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 6, 2026):

Hi @img88-nds! I'm Dosu and I’m helping the dify team.

This is a known and currently unresolved bug in Dify v1.12.1 where spaces between words can be removed in child chunks when using Knowledge Pipeline with Parent Chunk Mode. The root cause is in the chunking logic: when splitting by spaces, the splitter sometimes merges splits without re-inserting the separator, which causes spaces to disappear between words in some child chunks. This happens due to how the splitter's merging function is configured, especially when the _keep_separator flag is set and an empty string is used as the joiner, leading to the observed issue. Both normal and space-removed chunks can appear in the same output because of this inconsistent handling in the chunking process. There is no official fix or documented workaround yet, and recent updates have not addressed this specific bug. You can monitor the open issue for updates or consider experimenting with custom chunking rules or delimiters as a temporary workaround, but a code-level fix will likely be needed for a permanent solution.
Reference

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 6, 2026): <!-- Greeting --> Hi @img88-nds! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This is a known and currently unresolved bug in Dify v1.12.1 where spaces between words can be removed in child chunks when using Knowledge Pipeline with Parent Chunk Mode. The root cause is in the chunking logic: when splitting by spaces, the splitter sometimes merges splits without re-inserting the separator, which causes spaces to disappear between words in some child chunks. This happens due to how the splitter's merging function is configured, especially when the `_keep_separator` flag is set and an empty string is used as the joiner, leading to the observed issue. Both normal and space-removed chunks can appear in the same output because of this inconsistent handling in the chunking process. There is no official fix or documented workaround yet, and recent updates have not addressed this specific bug. You can monitor the open issue for updates or consider experimenting with custom chunking rules or delimiters as a temporary workaround, but a code-level fix will likely be needed for a permanent solution. [Reference](https://github.com/langgenius/dify/blob/4430a1b3da4924e42974708e2b30571e5d473af6/api/core/rag/splitter/fixed_text_splitter.py#L52-L153) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/34143f88-be4c-494d-82eb-9c10b704e280?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/34143f88-be4c-494d-82eb-9c10b704e280?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/34143f88-be4c-494d-82eb-9c10b704e280?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/34143f88-be4c-494d-82eb-9c10b704e280?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/34143f88-be4c-494d-82eb-9c10b704e280?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/34143f88-be4c-494d-82eb-9c10b704e280?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/34143f88-be4c-494d-82eb-9c10b704e280?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20and%20currently%20unresolved%20bug%20in%20Dify%20v1.12.1%20where%20spaces%20between%20words%20can%20be%20removed%20in%20child%20chunks%20when%20using%20Knowledge%20Pipeline%20with%20Parent%20Chunk%20Mode.%20The%20root%20cause%20is%20in%20the%20chunking%20logic%3A%20when%20splitting%20by%20spaces%2C%20the%20splitter%20sometimes%20merges%20splits%20without%20re-inserting%20the%20separator%2C%20which%20causes%20spaces%20to%20disappear%20between%20words%20in%20some%20child%20chunks.%20This%20happens%20due%20to%20how%20the%20splitter%27s%20merging%20function%20is%20configured%2C%20especially%20when%20the%20%60_keep_separator%60%20flag%20is%20set%20and%20an%20empty%20string%20is%20used%20as%20the%20joiner%2C%20leading%20to%20the%20observed%20issue.%20Both%20normal%20and%20space-removed%20chunks%20can%20appear%20in%20the%20same%20output%20because%20of%20this%20inconsistent%20handling%20in%20the%20chunking%20process.%20There%20is%20no%20official%20fix%20or%20documented%20workaround%20yet%2C%20and%20recent%20updates%20have%20not%20addressed%20this%20specific%20bug.%20You%20can%20monitor%20the%20open%20issue%20for%20updates%20or%20consider%20experimenting%20with%20custom%20chunking%20rules%20or%20delimiters%20as%20a%20temporary%20workaround%2C%20but%20a%20code-level%20fix%20will%20likely%20be%20needed%20for%20a%20permanent%20solution.%20%20%0A%5BReference%5D%28https%3A//github.com/langgenius/dify/blob/4430a1b3da4924e42974708e2b30571e5d473af6/api/core/rag/splitter/fixed_text_splitter.py%23L52-L153%29)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/32066)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22127