goharbor/harbor · error · lib/errors.Error
ChallengesUnsupportedCode
ChallengesUnsupportedCode
Error message
bearer auth scheme isn't supported: %v
What it means
Ping probed the registry's /v2/ endpoint and none of the returned WWW-Authenticate challenges used the 'bearer' scheme, so token-based (distribution token) auth against this registry is unsupported; returned with ChallengesUnsupportedCode.
Solutions
- Verify the registry URL points to a Docker distribution-compatible registry with token auth
- If the registry only supports basic auth, configure the adapter accordingly instead of relying on Ping's bearer discovery
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/pkg/reg/util/util.go:58 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/0a8becad53768cd2.
Report an issue: GitHub.
Appendix: source
Thrown at src/pkg/reg/util/util.go:58
}
func Ping(registry *model.Registry) (string, string, error) {
client := &http.Client{
Transport: GetHTTPTransport(registry.Insecure, registry.CACertificate),
}
resp, err := client.Get(registry.URL + "/v2/")
if err != nil {
return "", "", err
}
defer resp.Body.Close()
challenges := challenge.ResponseChallenges(resp)
for _, challenge := range challenges {
if challenge.Scheme == "bearer" {
return challenge.Parameters["realm"], challenge.Parameters["service"], nil
}
}
return "", "", errors.New(nil).WithCode(errors.ChallengesUnsupportedCode).WithMessagef("bearer auth scheme isn't supported: %v", challenges)
}
// ParseRepository parses the "repository" provided into two parts: namespace and the rest
// the string before the last "/" is the namespace part
// c -> [,c]
// b/c -> [b,c]
// a/b/c -> [a/b,c]
func ParseRepository(repository string) (string, string) {
if len(repository) == 0 {
return "", ""
}
index := strings.LastIndex(repository, "/")
if index == -1 {
return "", repository
}
return repository[:index], repository[index+1:]
}
View on GitHub (pinned to 7b2fd08cc5)