goharbor/harbor · error

%s

Error message

%s

What it means

listNamespaces got a non-2xx response from Docker Hub's namespace listing API and returned the raw response body as the error text, which carries Docker Hub's own message (auth failure, rate limit, etc.).

Solutions

  1. Read the body text for the Docker Hub error detail
  2. Verify the Docker Hub credentials/token used by the adapter
  3. Retry after addressing auth or rate-limit issues
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/pkg/reg/adapter/dockerhub/adapter.go:175 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/a9c7953f4e1d7cf2. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/reg/adapter/dockerhub/adapter.go:175

	}
	return nil
}

func (a *adapter) listNamespaces() ([]string, error) {
	resp, err := a.client.Do(http.MethodGet, listNamespacePath, nil)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

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

	if resp.StatusCode/100 != 2 {
		log.Errorf("list namespace error: %s", string(body))
		return nil, fmt.Errorf("%s", string(body))
	}

	namespaces := NamespacesResp{}
	err = json.Unmarshal(body, &namespaces)
	if err != nil {
		return nil, err
	}
	log.Debugf("got namespaces %v by calling the listing namespaces API", namespaces)
	return namespaces.Namespaces, nil
}

// CreateNamespace creates a new namespace in DockerHub
func (a *adapter) CreateNamespace(namespace *model.Namespace) error {
	ns, err := a.getNamespace(namespace.Name)
	if err != nil {
		return fmt.Errorf("check existence of namespace '%s' error: %v", namespace.Name, err)
	}

View on GitHub (pinned to 7b2fd08cc5)