goharbor/harbor · error

[volcengine-cr.PrepareForPush] the name of the repository…

Error message

[volcengine-cr.PrepareForPush] the name of the repository and namespace cannot be null

What it means

Guard in volcenginecr PrepareForPush: resource.Metadata.Repository.Name is empty, so neither the repository nor its namespace can be determined for provisioning in Volcengine Container Registry.

Solutions

  1. Ensure the resource metadata carries a non-empty repository name
  2. Fix the upstream replication resource builder if names are dropped
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/reg/adapter/volcenginecr/adapter.go:148 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/5ce6a689eb92e7e5. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/reg/adapter/volcenginecr/adapter.go:148

}

func (a *adapter) PrepareForPush(resources []*model.Resource) (err error) {
	for _, resource := range resources {
		if resource == nil {
			return errors.New("the resource cannot be null")
		}
		if resource.Metadata == nil {
			return errors.New("[volcengine-cr.PrepareForPush] the metadata of resource cannot be null")
		}
		if resource.Metadata.Repository == nil {
			return errors.New("[volcengine-cr.PrepareForPush] the namespace of resource cannot be null")
		}
		if len(resource.Metadata.Repository.Name) == 0 {
			return errors.New("[volcengine-cr.PrepareForPush] the name of the namespace cannot be null")
		}
		var paths = strings.Split(resource.Metadata.Repository.Name, "/")
		if len(paths) < 2 {
			return errors.New("[volcengine-cr.PrepareForPush] the name of the repository and namespace cannot be null")
		}
		var namespace = paths[0]
		var repository = path.Join(paths[1:]...)

		log.Debugf("namespace=%s", namespace)
		err = a.createNamespace(namespace)
		if err != nil {
			log.Errorf("PrepareForPush error :%v", err)
			return
		}
		log.Debugf("namespace=%s, repository=%s", namespace, repository)
		err = a.createRepository(namespace, repository)
		if err != nil {
			log.Errorf("PrepareForPush error :%v", err)
			return
		}
	}
	return

View on GitHub (pinned to 7b2fd08cc5)