{"record":{"id":"a07638afa5d01d14","repo":"Tencent/WeKnora","slug":"error","errorCode":null,"errorMessage":"条目不能为空","messagePattern":"条目不能为空","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/knowledge_faq_import.go","lineNumber":962,"sourceCode":"\t\tif s != \"\" && !seen[s] {\n\t\t\tseen[s] = true\n\t\t\tresult = append(result, s)\n\t\t}\n\t}\n\tfor _, s := range b {\n\t\ts = strings.TrimSpace(s)\n\t\tif s != \"\" && !seen[s] {\n\t\t\tseen[s] = true\n\t\t\tresult = append(result, s)\n\t\t}\n\t}\n\treturn result\n}\n\n// validateFAQEntryPayloadBasic 验证 FAQ 条目的基本格式\nfunc validateFAQEntryPayloadBasic(entry *types.FAQEntryPayload) error {\n\tif entry == nil {\n\t\treturn fmt.Errorf(\"条目不能为空\")\n\t}\n\tstandardQ := strings.TrimSpace(entry.StandardQuestion)\n\tif standardQ == \"\" {\n\t\treturn fmt.Errorf(\"标准问不能为空\")\n\t}\n\tif len(entry.Answers) == 0 {\n\t\treturn fmt.Errorf(\"答案不能为空\")\n\t}\n\thasValidAnswer := false\n\tfor _, a := range entry.Answers {\n\t\tif strings.TrimSpace(a) != \"\" {\n\t\t\thasValidAnswer = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !hasValidAnswer {\n\t\treturn fmt.Errorf(\"答案不能全为空\")\n\t}","sourceCodeStart":944,"sourceCodeEnd":980,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_faq_import.go#L944-L980","documentation":"Basic FAQ import validation (validateFAQEntryPayloadBasic): the entries slice element being validated is a nil *FAQEntryPayload. It fires during append/replace-mode import validation when the payload contains a null entry where a FAQ object is required, before any field checks run.","triggerScenarios":"Thrown at internal/application/service/knowledge_faq_import.go:962 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove null elements from the entries array before submitting","Validate the JSON payload shape at the API layer before import","The failed entry is reported per-row in dry-run/import results"],"exampleFix":null,"handlingStrategy":"validation","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"}