diff --git a/backend/local_rag.py b/backend/local_rag.py index 1638b02..ef4b905 100644 --- a/backend/local_rag.py +++ b/backend/local_rag.py @@ -791,6 +791,11 @@ def _run_prepare_pipeline(slug: str, on_progress=None, **opts): emit="per-file", lang_detect=False, ) + build_errors = list((results.get("build") or {}).get("errors") or []) + if not paths["corpus"].exists() or _line_count(paths["corpus"]) == 0: + if build_errors: + raise RuntimeError(build_errors[0]) + raise RuntimeError("Corpus build produced no usable records.") _mark_pipeline_stage(slug, "build", corpus_signature) states["has_corpus"] = True states["is_enriched"] = False