goharbor/harbor · error

the name of namespace cannot be null

Error message

the name of namespace cannot be null

What it means

Error "the name of namespace cannot be null" thrown in goharbor/harbor.

Source

Thrown at src/pkg/reg/adapter/dtr/adapter.go:165

}

// PrepareForPush creates docker repository in DTR
func (a *adapter) PrepareForPush(resources []*model.Resource) error {
	var dtrNamespaces []Account
	var repos []string
	namespaces := make(map[string]string)
	for _, resource := range resources {
		if resource == nil {
			return errors.New("the resource cannot be null")
		}
		if resource.Metadata == nil {
			return errors.New("the metadata of resource cannot be null")
		}
		if resource.Metadata.Repository == nil {
			return errors.New("the namespace of resource cannot be null")
		}
		if len(resource.Metadata.Repository.Name) == 0 {
			return errors.New("the name of namespace cannot be null")
		}
		path := strings.Split(resource.Metadata.Repository.Name, "/")
		if len(path) > 0 {
			namespaces[path[0]] = path[0]
		}
		if len(resource.Metadata.Repository.Name) > 0 {
			repos = append(repos, resource.Metadata.Repository.Name)
		}
	}

	dtrNamespaces, err := a.clientDTRAPI.getNamespaces()
	if err != nil {
		log.Errorf("Failed to lookup namespaces from DTR: %v", err)
		return err
	}

	existingNamespaces := make(map[string]struct{})
	for _, namespace := range dtrNamespaces {

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/pkg/reg/adapter/dtr/adapter.go:165 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/3d99ac2c743f6bd3. Report an issue: GitHub.