{"record":{"id":"0c30a70bb4050766","repo":"Tencent/WeKnora","slug":"failed-to-parse-faq-import-result-w","errorCode":null,"errorMessage":"failed to parse FAQ import result: %w","messagePattern":"failed to parse FAQ import result: %w","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"internal/application/service/knowledge_faq_import.go","lineNumber":2837,"sourceCode":"\t}\n\n\t// 查找FAQ类型的knowledge\n\tvar faqKnowledge *types.Knowledge\n\tfor _, k := range knowledgeList {\n\t\tif k.Type == types.KnowledgeTypeFAQ {\n\t\t\tfaqKnowledge = k\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif faqKnowledge == nil {\n\t\treturn werrors.NewNotFoundError(\"FAQ knowledge not found in this knowledge base\")\n\t}\n\n\t// 解析当前的导入结果\n\tresult, err := faqKnowledge.GetLastFAQImportResult()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse FAQ import result: %w\", err)\n\t}\n\n\tif result == nil {\n\t\treturn werrors.NewNotFoundError(\"no FAQ import result found\")\n\t}\n\n\t// 更新显示状态\n\tresult.DisplayStatus = displayStatus\n\n\t// 保存更新后的结果\n\tif err := faqKnowledge.SetLastFAQImportResult(result); err != nil {\n\t\treturn fmt.Errorf(\"failed to set FAQ import result: %w\", err)\n\t}\n\n\t// 更新数据库\n\tif err := s.repo.UpdateKnowledge(ctx, faqKnowledge); err != nil {\n\t\treturn fmt.Errorf(\"failed to update knowledge: %w\", err)\n\t}","sourceCodeStart":2819,"sourceCodeEnd":2855,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_faq_import.go#L2819-L2855","documentation":"Thrown when GetLastFAQImportResult fails to unmarshal the last import result stored in the FAQ knowledge's metadata. Means the stored metadata JSON is corrupt or has an incompatible schema, not that a database call failed.","triggerScenarios":"Thrown at internal/application/service/knowledge_faq_import.go:2837 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the knowledge metadata JSON for truncation or schema drift","Re-run an import to overwrite the stored result with a fresh, well-formed record","Add migration/validation for legacy metadata formats"],"exampleFix":null,"handlingStrategy":"type-guard","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"}