goharbor/harbor · error

not a acr service

Error message

not a acr service

What it means

parseRegistryService rejects the service string because its first ':'-separated segment is not registry.aliyuncs.com (compared case-insensitively) — the configured URL does not denote an Aliyun ACR service at all.

Solutions

  1. Set the service prefix to registry.aliyuncs.com
  2. If the registry is not Aliyun ACR, use the native registry adapter instead of aliacr
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/reg/adapter/aliacr/adapter.go:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/19ed1550af8306e3. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/reg/adapter/aliacr/adapter.go:83

	rs := regACRServiceURL.FindStringSubmatch(url)
	if rs == nil {
		return url, nil
	}
	return fmt.Sprintf(registryEndpointTpl, rs[1]), nil
}

// example:
// registry.aliyuncs.com:cn-hangzhou:china:cri-xxxxxxxxx
// registry.aliyuncs.com:cn-hangzhou:26842
func parseRegistryService(service string) (*registryServiceInfo, error) {
	parts := strings.Split(service, ":")
	length := len(parts)
	if length < 2 {
		return nil, errors.New("invalid service format: expected 'registry.aliyuncs.com:region:xxxxx'")
	}

	if !strings.EqualFold(parts[0], registryACRService) {
		return nil, errors.New("not a acr service")
	}

	if strings.HasPrefix(parts[length-1], "cri-") {
		return &registryServiceInfo{
			IsACREE:    true,
			RegionID:   parts[1],
			InstanceID: parts[length-1],
		}, nil
	}
	return &registryServiceInfo{
		IsACREE:  false,
		RegionID: parts[1],
	}, nil
}

func newAdapter(registry *model.Registry) (*adapter, error) {
	url, err := getRegistryURL(registry.URL)
	if err != nil {

View on GitHub (pinned to 7b2fd08cc5)