{"record":{"id":"10c755d6ae436921","repo":"Tencent/WeKnora","slug":"verify-summary-freshness-w","errorCode":null,"errorMessage":"verify summary freshness: %w","messagePattern":"verify summary freshness: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/knowledge_process.go","lineNumber":1265,"sourceCode":"\t\t\t\tsummaryErr = updateErr\n\t\t\t\treturn fmt.Errorf(\"failed to update knowledge: %w\", updateErr)\n\t\t\t}\n\t\t\tsummaryOut[\"fallback\"] = \"insufficient_content\"\n\t\t\tsummaryErr = err\n\t\t\treturn nil\n\t\t}\n\t\treturn handleRetryableSummaryFailure(err)\n\t}\n\t// Do not publish an answer derived from a superseded chunk or metadata\n\t// version. A user can explicitly refresh again from the latest revision.\n\tstaleSummary, staleErr := summarySourceChanged(\n\t\tctx, s.repo, s.chunkRepo, payload.TenantID, payload.KnowledgeID, summaryMetadataVersion, textChunks,\n\t)\n\tif staleErr != nil {\n\t\tlogger.Errorf(ctx, \"Failed to verify summary freshness for knowledge %s: %v\", payload.KnowledgeID, staleErr)\n\t\tmarkSummaryFailed()\n\t\tsummaryErr = staleErr\n\t\treturn fmt.Errorf(\"verify summary freshness: %w\", staleErr)\n\t}\n\tif staleSummary {\n\t\tlogger.Infof(ctx, \"Discarding stale summary for knowledge %s\", payload.KnowledgeID)\n\t\tsummaryOut[\"skipped\"] = \"content_revision_changed\"\n\t\treturn nil\n\t}\n\n\t// Update knowledge description\n\tknowledge.Description = summary\n\tknowledge.SummaryStatus = types.SummaryStatusCompleted\n\tknowledge.UpdatedAt = time.Now()\n\tsummaryOut[\"summary_chars\"] = len([]rune(summary))\n\t// Preview the generated summary on the span output so the trace\n\t// viewer can show \"this is what the LLM produced\" at a glance,\n\t// without hopping to the knowledge-detail page. Capped to keep\n\t// span rows compact.\n\tsummaryOut[\"summary_preview\"] = previewText(summary, 240)\n\tif err := s.repo.UpdateKnowledge(ctx, knowledge); err != nil {","sourceCodeStart":1247,"sourceCodeEnd":1283,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_process.go#L1247-L1283","documentation":"Thrown when summarySourceChanged errors during the pre-publish freshness check for a successfully generated summary. The guard compares the summary's source chunks/metadata revision against current state to avoid publishing a summary of superseded content; failing to verify aborts publication.","triggerScenarios":"Thrown at internal/application/service/knowledge_process.go:1265 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check repo/chunkRepo availability for the revision comparison","Retry summary generation after the read failure clears","If content was genuinely refreshed concurrently, the next run regenerates from the new revision"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}