{"record":{"id":"311d63322525ac6a","repo":"Tencent/WeKnora","slug":"verify-summary-fallback-freshness-w","errorCode":null,"errorMessage":"verify summary fallback freshness: %w","messagePattern":"verify summary fallback freshness: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/knowledge_process.go","lineNumber":1195,"sourceCode":"\t\t\tif updateErr := s.repo.UpdateKnowledge(ctx, knowledge); updateErr != nil {\n\t\t\t\tlogger.Warnf(ctx, \"Failed to mark summary pending for retry: %v\", updateErr)\n\t\t\t}\n\t\t\tsummaryOut[\"retrying\"] = true\n\t\t\treturn fmt.Errorf(\"summary generation attempt failed: %w\", generationErr)\n\t\t}\n\n\t\t// Before publishing the terminal fallback, make sure its source still\n\t\t// matches the chunks and metadata captured for this attempt.\n\t\tstale, staleErr := summarySourceChanged(\n\t\t\tctx, s.repo, s.chunkRepo, payload.TenantID, payload.KnowledgeID,\n\t\t\tsummaryMetadataVersion, textChunks,\n\t\t)\n\t\tif staleErr != nil {\n\t\t\tlogger.Errorf(ctx, \"Failed to verify summary fallback freshness for knowledge %s: %v\",\n\t\t\t\tpayload.KnowledgeID, staleErr)\n\t\t\tmarkSummaryFailed()\n\t\t\tsummaryErr = staleErr\n\t\t\treturn fmt.Errorf(\"verify summary fallback freshness: %w\", staleErr)\n\t\t}\n\t\tif stale {\n\t\t\tlogger.Infof(ctx, \"Discarding stale summary fallback for knowledge %s\", payload.KnowledgeID)\n\t\t\tsummaryOut[\"skipped\"] = \"content_revision_changed\"\n\t\t\treturn nil\n\t\t}\n\n\t\tfallback := applyRetryableSummaryFailureState(knowledge, textChunks, false)\n\t\tif updateErr := s.repo.UpdateKnowledge(ctx, knowledge); updateErr != nil {\n\t\t\tlogger.Errorf(ctx, \"Failed to save terminal summary fallback: %v\", updateErr)\n\t\t\tsummaryErr = updateErr\n\t\t\treturn fmt.Errorf(\"save terminal summary fallback: %w\", updateErr)\n\t\t}\n\t\tif fallback == \"\" {\n\t\t\tsummaryOut[\"fallback\"] = \"empty\"\n\t\t} else {\n\t\t\tsummaryOut[\"fallback\"] = \"first_chunk\"\n\t\t}","sourceCodeStart":1177,"sourceCodeEnd":1213,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_process.go#L1177-L1213","documentation":"Thrown in the summary-generation retry-exhaustion path when summarySourceChanged itself errors while checking whether the terminal fallback summary still matches the current chunks/metadata revision. The freshness gate could not run, so the pre-computed fallback is discarded and the error surfaced.","triggerScenarios":"Thrown at internal/application/service/knowledge_process.go:1195 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check repo/chunkRepo availability used by the freshness check","Retry the summary task; knowledge is already marked pending for retry","Inspect logs for the underlying read failure on chunks or metadata version"],"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"}