Tencent/WeKnora · error

invalid MinIO file path: %s

Error message

invalid MinIO file path: %s

What it means

MinIO path parser guard: the supplied file path does not start with the 'minio://' scheme (or is otherwise malformed), so no bucket/objectKey can be extracted and the operation is rejected before any storage call.

Source

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

	return err
}

// CheckMinioConnectivity tests MinIO connectivity using the provided credentials.
// It creates a temporary service instance internally and delegates to CheckConnectivity.
func CheckMinioConnectivity(ctx context.Context, endpoint, accessKeyID, secretAccessKey, bucketName string, useSSL bool) error {
	svc, err := newMinioClient(endpoint, accessKeyID, secretAccessKey, bucketName, useSSL)
	if err != nil {
		return err
	}
	return svc.CheckConnectivity(ctx)
}

// parseMinioFilePath extracts the object name from a provider scheme: minio://{bucket}/{objectKey}
func (s *minioFileService) parseMinioFilePath(filePath string) (string, error) {
	// Provider scheme format: minio://{bucket}/{objectKey}
	const prefix = "minio://"
	if !strings.HasPrefix(filePath, prefix) {
		return "", fmt.Errorf("invalid MinIO file path: %s", filePath)
	}
	rest := strings.TrimPrefix(filePath, prefix)
	parts := strings.SplitN(rest, "/", 2)
	if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
		return "", fmt.Errorf("invalid MinIO file path: %s", filePath)
	}
	if parts[0] != s.bucketName {
		return "", fmt.Errorf("bucket mismatch in path: got %s, want %s", parts[0], s.bucketName)
	}
	if err := utils.SafeObjectKey(parts[1]); err != nil {
		return "", fmt.Errorf("invalid file path: %w", err)
	}
	return parts[1], nil
}

// SaveFile saves a file to MinIO
func (s *minioFileService) SaveFile(ctx context.Context,
	file *multipart.FileHeader, tenantID uint64, knowledgeID string,

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Pass paths in the form minio://{bucket}/{objectKey}
  2. Validate the scheme at the boundary that produced the path
Defensive patterns

Strategy: validation

When it happens

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