Diagnose a missing RAG citation by following the source identifier through the pipeline. Check whether the document existed, retrieval found it, context assembly kept it, generation referenced it, and the interface rendered the reference.
Missing text and missing display are different failures
An answer may contain a valid source reference that the UI drops during formatting. Conversely, the UI may correctly render an answer whose model input never included the needed document. Rewriting the prompt will not fix every citation problem.
Follow a known supporting source
- Choose a question whose applicable supporting passage has been reviewed.
- Check the source’s corpus membership, permissions, version, and availability.
- Record retrieved candidates and the final context after ranking and truncation.
- Compare generated citation identifiers with the allowed source set, then inspect rendered links.
Use stage evidence to narrow the cause
The fixture places the expected source in the corpus and retrieved candidates but removes it from the assembled context. The first lost stage is therefore context assembly. That could represent token budgeting, a formatting bug, or an overly aggressive filter; the example identifies the boundary rather than guessing the exact implementation defect.
Check support after repairing the link
A visible citation is not proof that its passage supports the claim. Once the missing reference is restored, review claim support and whether the viewer can access the source without bypassing permissions. Keep the question, source version, context snapshot reference, and output so the repair can be tested again.
Run the worked example
Save the synthetic Node.js example and run node diagnose-missing-rag-citations.mjs with Node.js 22 or newer. The assertions check the illustrated records and calculations; they do not test a deployed provider, SDK, or access control. No credentials or network connection are needed.
// Synthetic teaching fixture. No credentials, network calls, or production verification.
import assert from 'node:assert/strict';
const stages = [
{ name: 'corpus', ids: ['policy-7', 'faq-2'] },
{ name: 'retrieval', ids: ['policy-7'] },
{ name: 'context', ids: [] },
{ name: 'generation', ids: [] },
];
const firstMissing = stages.find(stage => !stage.ids.includes('policy-7'));
assert.equal(firstMissing.name, 'context');
console.log('Supporting source first disappeared during context assembly.');
References and further reading
Maintained by DriftRail. AI assisted the October 2026 content and template revision. Examples are illustrative; they are not measured product benchmarks. Suggest a correction.