goharbor/harbor · error

%d -- %s

Error message

%d -- %s

What it means

Returned by createNamespace when the Quay POST to create a namespace returns a non-2xx status. The message embeds the HTTP status code and response body, revealing why Quay rejected creation (permission denied, invalid name, or already exists). Note the body is passed as bytes, so it may render as a byte-slice in logs.

Solutions

  1. Read the embedded status code and body to identify the Quay rejection reason
  2. Grant the token namespace-creation permission or pre-create the namespace manually
  3. Use a valid Quay namespace name (lowercase alphanumeric)
  4. Retry only if the status indicates a transient server error
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/pkg/reg/adapter/quay/adapter.go:226 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/7b47ce86592e4851. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/reg/adapter/quay/adapter.go:226

	}

	req.Header.Set("Content-Type", "application/json")
	resp, err := a.client.Do(req)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	if resp.StatusCode/100 == 2 {
		return nil
	}

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return err
	}
	log.Errorf("create namespace error: %d -- %s", resp.StatusCode, string(body))
	return fmt.Errorf("%d -- %s", resp.StatusCode, body)
}

// getNamespace get namespace from Quay, if the namespace not found, two nil would be returned.
func (a *adapter) getNamespace(namespace string) (*model.Namespace, error) {
	req, err := http.NewRequest(http.MethodGet, buildOrgURL(a.registry.URL, namespace), nil)
	if err != nil {
		return nil, err
	}

	resp, err := a.client.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, err

View on GitHub (pinned to 7b2fd08cc5)