goharbor/harbor · error

bad aws url

Error message

bad aws url

What it means

parseAccountRegion could not match the AWS ECR registry URL against the expected account.dkr.ecr.region pattern (regex produced fewer than 3 groups), so neither the account ID nor the region can be extracted for building the ECR client.

Solutions

  1. Use the standard ECR URL format <account>.dkr.ecr.<region>.amazonaws.com
  2. Verify the region and account portions were not mangled when the registry was configured
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/reg/adapter/awsecr/adapter.go:71 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/bfcd62a4db2f5ee0. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/reg/adapter/awsecr/adapter.go:71

		return nil, err
	}
	svc, err := getAwsSvc(
		region, registry.Credential.AccessKey, registry.Credential.AccessSecret, registry.Insecure, registry.CACertificate, nil)
	if err != nil {
		return nil, err
	}
	authorizer := NewAuth(registry.Credential.AccessKey, svc)
	return &adapter{
		registry: registry,
		Adapter:  native.NewAdapterWithAuthorizer(registry, authorizer),
		cacheSvc: svc,
	}, nil
}

func parseAccountRegion(url string) (string, string, error) {
	rs := ecrRegexp.FindStringSubmatch(url)
	if rs == nil || len(rs) < 3 {
		return "", "", errors.New("bad aws url")
	}
	return rs[1], rs[2], nil
}

type factory struct {
}

// Create ...
func (f *factory) Create(r *model.Registry) (adp.Adapter, error) {
	return newAdapter(r)
}

// AdapterPattern ...
func (f *factory) AdapterPattern() *model.AdapterPattern {
	return getAdapterInfo()
}

var (

View on GitHub (pinned to 7b2fd08cc5)