Pipeline errors

Common error signatures

Failures in the RAG pipeline fall into three broad categories: misconfigured pipeline components, retrieval producing no results, and LLM generation errors. They typically appear as exceptions raised from RagPipeline.run() or RagPipeline.run_and_generate() and are visible in the returned RagResult fields — particularly fallback_used: bool and confidence: float.

Watch for these specific conditions:

Where errors originate

Trace the failure to the specific method before walking the call stack further.

How to diagnose

  1. Inspect RagResult fields first. Before examining the traceback, check fallback_used, confidence, and context on the returned RagResult. A fallback_used=True result with an empty context confirms retrieval found nothing — the problem is in the corpus or query, not the pipeline code itself.

  2. Check that corpus and retriever are not None. Both are optional constructor parameters, but run() requires them at call time. Print pipeline.corpus before calling run() to confirm the pipeline is fully initialised.

  3. Validate prompt_variant against PROMPT_VARIANTS. If the traceback points to prompt assembly, confirm the variant string you're passing is a key in PROMPT_VARIANTS. Log or print the value immediately before the run() call.

  4. Trace run_and_generate() failures to their layer. This method returns tuple[str, RagResult]. If the exception occurs before the LLM call, the RagResult will not be available. If it occurs after, inspect the returned result for elapsed_ms and confidence to understand what the retrieval stage produced.

  5. Check claim_citations and used_native_citations for generation-side issues. When use_native_citations=True is passed to run_and_generate(), the pipeline delegates citation extraction to the LLM. If used_native_citations is False on the result despite being requested, the provider did not support it — confirm your provider and model support native citations.

Source files

Tags: pipeline, orchestration, rag, result