[BUG] Token chunking strategy silently drops text when overlap is set

Open Beginner friendly
#10,706 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend, data

Research direction

Start by reading iterateWordBoundaryChunkSpans in apps/sim/lib/chunkers/utils.ts and trace how it advances chunk windows when a window ends at a space. Reproduce with Token strategy, max size 1024, overlap 200, and text containing long runs without spaces; verify every source character appears in at least one chunk.

Written by the indexing model from the issue text.

Description

Describe the bug
With the Token strategy and overlap greater than 0, the window advances by a fixed step from its start. When a window ends early at a space, the text between that space and the next window's start lands in no chunk, so it is never embedded or searchable.

To Reproduce

  1. Create a knowledge base with the Token strategy, max size 1024 and overlap 200.
  2. Upload text with long runs without spaces, such as Chinese prose with a few English words, long URLs or base64.
  3. Compare the chunk text with the source: whole stretches are missing.

Expected behavior
Every character of the document appears in at least one chunk.

Additional context
iterateWordBoundaryChunkSpans in apps/sim/lib/chunkers/utils.ts. Documents already indexed would need re-processing to recover the missing text.

Dominant language
TypeScript
Stars
29.8k
Forks
3.9k
Avg merge
1h 43m
Merged PRs (30d)
937

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from simstudioai/sim

All issues in simstudioai/sim

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.