HKUDS/DeepTutor · error · RuntimeError
Re-index found no valid documents to index in
Error message
Re-index found no valid documents to index in '{kb_name}'. What it means
Re-index outcome guard in run_reindex_task: the indexing pipeline returned False, which it reserves exclusively for 'no documents to index' — after processing, no valid documents remained in the KB (all candidates failed parsing/validation and were dropped), so no index version was produced. Real pipeline errors (embedding API, parse failures) are raised by the pipeline itself and appear separately in the task log.
Solutions
- Inspect the task log for per-document parse/validation failures
- Replace or fix corrupt/unsupported documents in raw/
- Re-run the re-index once at least one valid document is present
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at deeptutor/api/routers/knowledge.py:2840 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/54708b1cf86810aa.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/api/routers/knowledge.py:2840
ProgressStage.PROCESSING_DOCUMENTS,
message_key="Embedding batches: {{current}}/{{total}}",
message_params={"current": batch_num, "total": total_batches},
current=batch_num,
total=total_batches,
)
# The pipeline now raises the underlying error (embedding API
# failure, parse error, etc.) so it surfaces in the task log
# rather than being swallowed into a generic wrapper. A False
# return is reserved for "no documents to index" — surface that
# specifically too.
success = await rag_service.initialize(
kb_name=kb_name,
file_paths=file_paths,
progress_callback=_on_progress,
)
if not success:
raise RuntimeError(f"Re-index found no valid documents to index in '{kb_name}'.")
completed_at = datetime.now().isoformat()
metadata_file = kb_dir / "metadata.json"
try:
metadata = {}
if metadata_file.exists():
with open(metadata_file, encoding="utf-8") as handle:
loaded_metadata = json.load(handle)
if isinstance(loaded_metadata, dict):
metadata = loaded_metadata
metadata["last_updated"] = completed_at
metadata["last_indexed_at"] = completed_at
metadata["last_indexed_count"] = len(file_paths)
metadata["last_indexed_action"] = "reindex"
atomic_write_json(metadata_file, metadata)
except Exception as meta_err:
logger.warning(
"Failed to update re-index metadata for '%s': %s",View on GitHub (pinned to 3e82f13042)