goharbor/harbor · error · errs.baseError

10011

10011

Error message

header '%s' missing

What it means

Error "header '%s' missing" thrown in goharbor/harbor.

Source

Thrown at src/jobservice/api/authenticator.go:56

	//
	// Returns:
	// nil returned if successfully done
	// otherwise an error returned
	DoAuth(req *http.Request) error
}

// SecretAuthenticator implements interface 'Authenticator' based on simple secret.
type SecretAuthenticator struct{}

// DoAuth implements same method in interface 'Authenticator'.
func (sa *SecretAuthenticator) DoAuth(req *http.Request) error {
	if req == nil {
		return errors.New("nil request")
	}

	h := strings.TrimSpace(req.Header.Get(authHeader))
	if utils.IsEmptyStr(h) {
		return fmt.Errorf("header '%s' missing", authHeader)
	}

	if !strings.HasPrefix(h, secretPrefix) {
		return fmt.Errorf("'%s' should start with '%s'", authHeader, secretPrefix)
	}

	secret := strings.TrimSpace(strings.TrimPrefix(h, secretPrefix))
	// incase both two are empty
	if utils.IsEmptyStr(secret) {
		return errors.New("empty secret is not allowed")
	}

	expectedSecret := config.GetUIAuthSecret()
	if subtle.ConstantTimeCompare([]byte(expectedSecret), []byte(secret)) == 0 {
		return errors.New("unauthorized")
	}

	return nil

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/jobservice/api/authenticator.go:56 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/be9cc058081033c6. Report an issue: GitHub.