Tencent/WeKnora · error · ErrCrossBackendCopy
minio copy rejected source %q: %w
Error message
minio copy rejected source %q: %w
What it means
Cross-backend copy guard: the source path failed to parse as a minio:// path, so it belongs to a different storage backend; the copy is rejected with the ErrCrossBackendCopy sentinel because a server-side MinIO CopyObject is impossible across backends.
Source
Thrown at internal/application/service/file/minio.go:183
return err
}
if err := s.client.RemoveObject(ctx, s.bucketName, objectName, minio.RemoveObjectOptions{
GovernanceBypass: true,
}); err != nil {
return fmt.Errorf("failed to delete file: %w", err)
}
return nil
}
// CopyFile copies an existing MinIO object to a new knowledge-owned object using a
// server-side CopyObject (no data leaves MinIO). The destination uses the same
// layout as SaveFile. Returns ErrCrossBackendCopy when srcPath is not a minio:// path.
func (s *minioFileService) CopyFile(ctx context.Context,
srcPath string, tenantID uint64, knowledgeID string,
) (string, error) {
srcKey, err := s.parseMinioFilePath(srcPath)
if err != nil {
return "", fmt.Errorf("minio copy rejected source %q: %w", srcPath, ErrCrossBackendCopy)
}
ext := filepath.Ext(srcPath)
destKey := fmt.Sprintf("%d/%s/%s%s", tenantID, knowledgeID, uuid.New().String(), ext)
_, err = s.client.CopyObject(ctx,
minio.CopyDestOptions{Bucket: s.bucketName, Object: destKey},
minio.CopySrcOptions{Bucket: s.bucketName, Object: srcKey},
)
if err != nil {
return "", fmt.Errorf("failed to copy file in MinIO: %w", err)
}
newPath := fmt.Sprintf("minio://%s/%s", s.bucketName, destKey)
logger.Infof(ctx, "Copied MinIO object %s to %s", srcPath, newPath)
return newPath, nil
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Route the copy to the backend that owns the source path
- Download from the source backend and re-upload to MinIO if cross-backend copy is required
- Check for the sentinel with errors.Is in callers
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at internal/application/service/file/minio.go:183 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/2fcba1f526de1dbc.
Report an issue: GitHub.