goharbor/harbor · error

no bearer challenge found

Error message

no bearer challenge found

What it means

In ACR's buildTokenAPI, the Docker v2 ping response's WWW-Authenticate challenges contained no 'bearer' scheme challenge, so the token-issuing realm cannot be discovered and OAuth token exchange cannot proceed.

Solutions

  1. Ensure the registry is an Azure CR configured for token (OAuth2/bearer) auth, not basic auth
  2. Check that an intermediary proxy does not rewrite the WWW-Authenticate header
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/pkg/reg/adapter/azurecr/auth.go:143 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/80c63bcef0e93ef3. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/reg/adapter/azurecr/auth.go:143

	resp, err := a.client.Get(v2URL.String())
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	challenges := challenge.ResponseChallenges(resp)
	if len(challenges) == 0 {
		return nil, errors.New("invalid response challenges")
	}
	cm := map[string]challenge.Challenge{}
	for _, challenge := range challenges {
		cm[challenge.Scheme] = challenge
	}

	challenge, exist := cm["bearer"]
	if !exist {
		return nil, errors.New("no bearer challenge found")
	}

	tokenURL, err := url.Parse(challenge.Parameters["realm"])
	if err != nil {
		return nil, err
	}

	query := tokenURL.Query()
	query.Add("service", challenge.Parameters["service"])

	var repository string
	if subs := lib.V2TagListURLRe.FindStringSubmatch(u.Path); len(subs) >= 2 {
		// tag
		repository = subs[1]
	}

	if repository == "" {
		return nil, errors.Errorf("invalid repository name, url: %s", u.String())

View on GitHub (pinned to 7b2fd08cc5)