run-llama/llama_index · error · ValueError
No files found in {input_dir}.
Error message
No files found in {input_dir}. What it means
Raised by SimpleDirectoryReader._add_files when, after walking input_dir, zero files survived the filters. Files are skipped when they are hidden (dot-prefixed parts), have a bad extension (not in required_exts or in exclude), match the exclude glob, or are empty (recursive case). The error means the directory exists but nothing in it is eligible for ingestion.
Source
Thrown at llama-index-core/llama_index/core/readers/file/base.py:425
rejected_dir,
)
break
if (
is_dir
or skip_because_hidden
or skip_because_bad_ext
or skip_because_excluded
or skip_because_empty
):
continue
else:
all_files.add(ref)
new_input_files = sorted(all_files)
if len(new_input_files) == 0:
raise ValueError(f"No files found in {input_dir}.")
# print total number of files added
logger.debug(
f"> [SimpleDirectoryReader] Total files added: {len(new_input_files)}"
)
return new_input_files
def _exclude_metadata(self, documents: list[Document]) -> list[Document]:
"""
Exclude metadata from documents.
Args:
documents (List[Document]): List of documents.
"""
for doc in documents:
# Keep only metadata['file_path'] in both embedding and llm contentView on GitHub (pinned to afd0fef371)
Solutions
- List what would be ingested: check the directory contents and compare extensions case-sensitively against required_exts (include both '.pdf' and '.PDF' or normalize).
- Loosen or remove exclude/recursive filters to confirm they are not removing everything.
- If files are empty (0 bytes), fix the upstream export/copy step that produced them.
- Pass input_files=[...] explicitly if you know the exact files you want, bypassing directory filtering.
Example fix
# before
reader = SimpleDirectoryReader(input_dir="./docs", required_exts=[".PDF"])
# after
reader = SimpleDirectoryReader(
input_dir="./docs",
required_exts=[".pdf", ".PDF"],
) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
exts = {p.suffix.lower() for p in Path("./docs").rglob("*") if p.is_file()}
assert exts, "no files found"
assert ".pdf" in exts, f"no .pdf files; found: {exts}" Prevention
- Compare extensions case-insensitively against required_exts.
- Smoke-test the directory listing before building the index.
- Prefer input_files for small known file sets to bypass filtering.
When it happens
Trigger: Passing required_exts=['.pdf'] to a directory containing only .txt/.docx files; using exclude patterns that match everything; pointing at a directory that only contains hidden dotfiles or empty subdirectories with only empty files; a directory whose files are all 0 bytes.
Common situations: Data exported to a different format than expected; case-sensitivity mistakes such as required_exts=['.PDF'] on Linux while files are named .pdf; recursive=True against a tree where only hidden config files exist; overly broad exclude='**' patterns.
Related errors
- Directory {input_dir} does not exist.
- LLM must be a FunctionCallingLLM
- At least one agent must be provided
- No embeddings to aggregate
- resolve_image returned zero bytes
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/29b9795370e718e2.
Report an issue: GitHub.