{"record":{"id":"54708b1cf86810aa","repo":"HKUDS/DeepTutor","slug":"re-index-found-no-valid-documents-to-index-in-kb","errorCode":null,"errorMessage":"Re-index found no valid documents to index in '{kb_name}'.","messagePattern":"Re-index found no valid documents to index in '(.+?)'\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"deeptutor/api/routers/knowledge.py","lineNumber":2840,"sourceCode":"                    ProgressStage.PROCESSING_DOCUMENTS,\n                    message_key=\"Embedding batches: {{current}}/{{total}}\",\n                    message_params={\"current\": batch_num, \"total\": total_batches},\n                    current=batch_num,\n                    total=total_batches,\n                )\n\n            # The pipeline now raises the underlying error (embedding API\n            # failure, parse error, etc.) so it surfaces in the task log\n            # rather than being swallowed into a generic wrapper. A False\n            # return is reserved for \"no documents to index\" — surface that\n            # specifically too.\n            success = await rag_service.initialize(\n                kb_name=kb_name,\n                file_paths=file_paths,\n                progress_callback=_on_progress,\n            )\n            if not success:\n                raise RuntimeError(f\"Re-index found no valid documents to index in '{kb_name}'.\")\n\n            completed_at = datetime.now().isoformat()\n            metadata_file = kb_dir / \"metadata.json\"\n            try:\n                metadata = {}\n                if metadata_file.exists():\n                    with open(metadata_file, encoding=\"utf-8\") as handle:\n                        loaded_metadata = json.load(handle)\n                    if isinstance(loaded_metadata, dict):\n                        metadata = loaded_metadata\n                metadata[\"last_updated\"] = completed_at\n                metadata[\"last_indexed_at\"] = completed_at\n                metadata[\"last_indexed_count\"] = len(file_paths)\n                metadata[\"last_indexed_action\"] = \"reindex\"\n                atomic_write_json(metadata_file, metadata)\n            except Exception as meta_err:\n                logger.warning(\n                    \"Failed to update re-index metadata for '%s': %s\",","sourceCodeStart":2822,"sourceCodeEnd":2858,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/knowledge.py#L2822-L2858","documentation":"Error \"Re-index found no valid documents to index in '{kb_name}'.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/knowledge.py:2840 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}