Skip to content

fix: QA index processor preview key error#34236

Open
cyphercodes wants to merge 1 commit intolanggenius:mainfrom
cyphercodes:fix/qa-preview-key-error
Open

fix: QA index processor preview key error#34236
cyphercodes wants to merge 1 commit intolanggenius:mainfrom
cyphercodes:fix/qa-preview-key-error

Conversation

@cyphercodes
Copy link
Copy Markdown

Summary

Fixed a KeyError that occurred when using QA blocks in knowledge base workflows.

Root Cause

The QAIndexProcessor.format_preview method was returning a dictionary with the key 'qa_preview', but the parent IndexProcessor.format_preview method expected the key 'preview'. This caused a KeyError: 'preview' when iterating through the preview items.

Changes

  • api/core/rag/index_processor/processor/qa_index_processor.py: Changed the return key from 'qa_preview' to 'preview' to match the expected interface.

Testing

This fix ensures that QA blocks in knowledge base workflows can be previewed without errors.

Fixes #34144

The QAIndexProcessor.format_preview method was returning 'qa_preview'
key but the parent IndexProcessor.format_preview expected 'preview' key,
causing a KeyError when using QA blocks in knowledge base workflows.

Changed the return key from 'qa_preview' to 'preview' to match the
expected interface.

Fixes langgenius#34144
@cyphercodes cyphercodes requested a review from JohnJyong as a code owner March 29, 2026 01:21
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 29, 2026
Copy link
Copy Markdown

@mahdirajaee mahdirajaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, minimal fix that addresses the root cause directly. The QA index processor was returning qa_preview while the base IndexProcessor.format_preview interface expects preview, so this KeyError would have occurred every time a user attempted to preview QA-indexed segments through the knowledge base workflow.

One concern worth considering: this is a public-facing API response key change. If any external consumers (plugins, third-party integrations, or the frontend) were already handling the qa_preview key as a fallback or special case, changing it to preview could break those consumers in a different way. It would be worth verifying that the frontend chunk preview rendering code only reads from preview and never checks for qa_preview. That said, since the bug report indicates this was simply broken (KeyError), it is likely nobody was successfully consuming the old key anyway. The fix looks correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Knowledge base workflow, QA blocks and connects to knowledge base nodes, error message: Node 1750836372241 failed with ABORT strategy: 'preview'

2 participants