goharbor/harbor · error

repository did not contain a namespace

Error message

repository did not contain a namespace

What it means

Error "repository did not contain a namespace" thrown in goharbor/harbor.

Source

Thrown at src/pkg/reg/adapter/dtr/client.go:263

			query.Set("start", nextPage)
			endpoint = urlAPI.Scheme + "://" + urlAPI.Host + urlAPI.Path + "?" + query.Encode()
		}
	}

	return accounts, nil
}

// createRepository creates a repository in DTR.  The namespace/org/account must already exist.
func (c *Client) createRepository(repository string) error {
	var namespace string
	var repositoryName string

	path := strings.Split(repository, "/")
	if len(path) > 1 {
		namespace = path[0]
		repositoryName = path[1]
	} else {
		return errors.New("repository did not contain a namespace")
	}

	repo := newDefaultDTRRepository(repositoryName)
	body, err := json.Marshal(repo)
	if err != nil {
		return err
	}

	urlAPI := fmt.Sprintf("%s/api/v0/repositories/%s", c.url, namespace)
	log.Debugf("Creating repo %s in DTR at %s", repositoryName, urlAPI)
	req, err := http.NewRequest(http.MethodPost, urlAPI, bytes.NewReader(body))
	if err != nil {
		return err
	}
	req.Header.Set("Content-Type", "application/json")
	req.SetBasicAuth(c.username, c.password)

	resp, err := c.client.Do(req)

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/pkg/reg/adapter/dtr/client.go:263 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/4cbf2667d6d91fe6. Report an issue: GitHub.