{"record":{"id":"f788cb91c6ec986a","repo":"Tencent/WeKnora","slug":"qa-pipeline-error-s","errorCode":null,"errorMessage":"QA pipeline error: %s","messagePattern":"QA pipeline error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/im/service.go","lineNumber":2608,"sourceCode":"\t\t\tanswerBuilder.WriteString(data.Content)\n\t\t\tstreamedAny = true\n\t\t}\n\t\tbufMu.Unlock()\n\n\t\tif data.Done {\n\t\t\tcloseDone()\n\t\t}\n\t\treturn nil\n\t})\n\n\teventBus.On(event.EventError, func(_ context.Context, evt event.Event) error {\n\t\tdata, ok := evt.Data.(event.ErrorData)\n\t\tif !ok {\n\t\t\treturn nil\n\t\t}\n\t\tlogger.Errorf(ctx, \"[IM] QA stream error: %s\", data.Error)\n\t\tbufMu.Lock()\n\t\tqaErr = fmt.Errorf(\"QA pipeline error: %s\", data.Error)\n\t\tbufMu.Unlock()\n\t\tcloseDone()\n\t\tcloseComplete()\n\t\treturn nil\n\t})\n\n\teventBus.On(event.EventAgentReferences, func(_ context.Context, evt event.Event) error {\n\t\tdata, ok := evt.Data.(event.AgentReferencesData)\n\t\tif !ok {\n\t\t\treturn nil\n\t\t}\n\t\tbufMu.Lock()\n\t\tif assistantMsg != nil {\n\t\t\trefs := []*types.SearchResult(assistantMsg.KnowledgeReferences)\n\t\t\tcollectIMKnowledgeReferences(&refs, data.References)\n\t\t\tassistantMsg.KnowledgeReferences = types.References(refs)\n\t\t}\n\t\tbufMu.Unlock()","sourceCodeStart":2590,"sourceCodeEnd":2626,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/im/service.go#L2590-L2626","documentation":"During streaming QA, the event.ErrorData handler captures the pipeline failure into qaErr (\"QA pipeline error: %s\", bufMu-protected) and signals completion. The caller logs it and sends a fallback reply via imQAFailureReply instead of an answer.","triggerScenarios":"Any failure inside the streaming QA pipeline — agent/LLM invocation error, knowledge-base retrieval failure, upstream stream error event — surfaces as ErrorData on the event stream and is wrapped by this message.","commonSituations":"LLM provider outage or invalid API key; knowledge base unavailable; agent misconfiguration; context deadline exceeded during generation.","solutions":["Check the underlying data.Error text in the log line '[IM] QA stream error' for the root cause","Verify LLM provider credentials/quotas and KB connectivity","Rely on the fallback reply path (imQAFailureReply) which is already sent to the user; retry the message after the pipeline recovers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if qaErr != nil {\n    logger.Errorf(ctx, \"[IM] QA failed: %v\", qaErr)\n    answer = imQAFailureReply(qaErr) // graceful fallback reply\n}","preventionTips":["Monitor '[IM] QA stream error' logs and alert on the root cause (LLM/KB outages)","Configure retries/timeouts on the LLM provider and knowledge-base clients","Keep imQAFailureReply configured so users always get a response"],"tags":["qa","pipeline","streaming","llm"],"backgroundTag":"qa-pipeline-failure","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}