Tencent/WeKnora · error

failed to upload bytes to MinIO: %w

Error message

failed to upload bytes to MinIO: %w

What it means

MinIO PutObject failed while uploading the in-memory byte payload to the generated exports object key, so the bytes were not persisted; bucket permissions, size limits, or connectivity are the usual wrapped causes.

Source

Thrown at internal/application/service/file/minio.go:218

}

// SaveBytes saves bytes data to MinIO and returns the file path
// temp parameter is ignored for MinIO (no auto-expiration support in this implementation)
func (s *minioFileService) SaveBytes(ctx context.Context, data []byte, tenantID uint64, fileName string, temp bool) (string, error) {
	safeName, err := utils.SafeFileName(fileName)
	if err != nil {
		return "", fmt.Errorf("invalid file name: %w", err)
	}
	ext := filepath.Ext(safeName)
	objectName := fmt.Sprintf("%d/exports/%s%s", tenantID, uuid.New().String(), ext)

	// Upload bytes to MinIO
	reader := bytes.NewReader(data)
	_, err = s.client.PutObject(ctx, s.bucketName, objectName, reader, int64(len(data)), minio.PutObjectOptions{
		ContentType: utils.GetContentTypeByExt(ext),
	})
	if err != nil {
		return "", fmt.Errorf("failed to upload bytes to MinIO: %w", err)
	}

	return fmt.Sprintf("minio://%s/%s", s.bucketName, objectName), nil
}

// GetFileURL returns a presigned download URL for the file
func (s *minioFileService) GetFileURL(ctx context.Context, filePath string) (string, error) {
	objectName, err := s.parseMinioFilePath(filePath)
	if err != nil {
		return "", err
	}
	presignedURL, err := s.client.PresignedGetObject(ctx, s.bucketName, objectName, 24*time.Hour, nil)
	if err != nil {
		return "", fmt.Errorf("failed to generate presigned URL: %w", err)
	}
	return presignedURL.String(), nil
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check MinIO health and write permissions
  2. Verify quota/size limits for exports
  3. Retry the byte upload on transient failures
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/application/service/file/minio.go:218 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/f02653380ca140ce. Report an issue: GitHub.