Tencent/WeKnora · error

failed to upload entries: %w

Error message

failed to upload entries: %w

What it means

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.

Source

Thrown at internal/application/service/knowledge_faq_import.go:163

	)

	entryCount := len(payload.Entries)
	if entryCount > entryCountThreshold {
		// 数据量较大,上传到对象存储
		entriesData, err := json.Marshal(payload.Entries)
		if err != nil {
			logger.Errorf(ctx, "Failed to marshal FAQ entries: %v", err)
			return "", fmt.Errorf("failed to marshal entries: %w", err)
		}

		logger.Infof(ctx, "FAQ entries size: %d bytes, uploading to object storage", len(entriesData))

		// 上传到私有桶(主桶),任务处理完成后清理
		fileName := fmt.Sprintf("faq_import_entries_%s_%d.json", taskID, enqueuedAt)
		entriesURL, err := s.fileSvc.SaveBytes(ctx, entriesData, tenantID, fileName, false)
		if err != nil {
			logger.Errorf(ctx, "Failed to upload FAQ entries to object storage: %v", err)
			return "", fmt.Errorf("failed to upload entries: %w", err)
		}

		logger.Infof(ctx, "FAQ entries uploaded to: %s", entriesURL)
		taskPayload.EntriesURL = entriesURL
		taskPayload.EntryCount = entryCount
	} else {
		// 数据量较小,直接存储在 payload 中
		taskPayload.Entries = payload.Entries
	}

	langfuse.InjectTracing(ctx, &taskPayload)
	payloadBytes, err := json.Marshal(taskPayload)
	if err != nil {
		logger.Errorf(ctx, "Failed to marshal FAQ import task payload: %v", err)
		return "", fmt.Errorf("failed to marshal task payload: %w", err)
	}

	// 再次检查 payload 大小

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check object storage (S3/OSS) availability, credentials, and bucket policy
  2. Verify the tenant's storage quota is not exhausted
  3. Retry the import; the file is written to the private bucket and cleaned up after processing
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/application/service/knowledge_faq_import.go:163 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/6ffd89fba0dd00d6. Report an issue: GitHub.