{"record":{"id":"6ffd89fba0dd00d6","repo":"Tencent/WeKnora","slug":"failed-to-upload-entries-w","errorCode":null,"errorMessage":"failed to upload entries: %w","messagePattern":"failed to upload entries: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/knowledge_faq_import.go","lineNumber":163,"sourceCode":"\t)\n\n\tentryCount := len(payload.Entries)\n\tif entryCount > entryCountThreshold {\n\t\t// 数据量较大，上传到对象存储\n\t\tentriesData, err := json.Marshal(payload.Entries)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(ctx, \"Failed to marshal FAQ entries: %v\", err)\n\t\t\treturn \"\", fmt.Errorf(\"failed to marshal entries: %w\", err)\n\t\t}\n\n\t\tlogger.Infof(ctx, \"FAQ entries size: %d bytes, uploading to object storage\", len(entriesData))\n\n\t\t// 上传到私有桶（主桶），任务处理完成后清理\n\t\tfileName := fmt.Sprintf(\"faq_import_entries_%s_%d.json\", taskID, enqueuedAt)\n\t\tentriesURL, err := s.fileSvc.SaveBytes(ctx, entriesData, tenantID, fileName, false)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(ctx, \"Failed to upload FAQ entries to object storage: %v\", err)\n\t\t\treturn \"\", fmt.Errorf(\"failed to upload entries: %w\", err)\n\t\t}\n\n\t\tlogger.Infof(ctx, \"FAQ entries uploaded to: %s\", entriesURL)\n\t\ttaskPayload.EntriesURL = entriesURL\n\t\ttaskPayload.EntryCount = entryCount\n\t} else {\n\t\t// 数据量较小，直接存储在 payload 中\n\t\ttaskPayload.Entries = payload.Entries\n\t}\n\n\tlangfuse.InjectTracing(ctx, &taskPayload)\n\tpayloadBytes, err := json.Marshal(taskPayload)\n\tif err != nil {\n\t\tlogger.Errorf(ctx, \"Failed to marshal FAQ import task payload: %v\", err)\n\t\treturn \"\", fmt.Errorf(\"failed to marshal task payload: %w\", err)\n\t}\n\n\t// 再次检查 payload 大小","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_faq_import.go#L145-L181","documentation":"Thrown when fileSvc.SaveBytes fails to upload the serialized FAQ entries JSON to the tenant's private object-storage bucket (large-batch path >200 entries). Fires on storage outages, permission denials, or bucket misconfiguration; the async task is not enqueued.","triggerScenarios":"Thrown at internal/application/service/knowledge_faq_import.go:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check object storage (S3/OSS) availability, credentials, and bucket policy","Verify the tenant's storage quota is not exhausted","Retry the import; the file is written to the private bucket and cleaned up after processing"],"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"}