goharbor/harbor · error

invalid , shoud be one of

Error message

invalid %s, shoud be one of %s, %s, %s, %s, %s

What it means

AuthModeType.validate rejected the auth_mode configuration value because it is not one of the five supported authentication modes (db_auth, ldap_auth, uaa_auth, http_auth, oidc_auth); the message lists the setting name and every allowed value.

Solutions

  1. Set auth_mode to one of the enumerated values: db_auth, ldap_auth, uaa_auth, http_auth or oidc_auth
  2. Check for typos or trailing whitespace in the configured value
  3. After fixing, re-apply the configuration change via the config API or harbor.yml
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/config/metadata/type.go:70 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/9abd3ddc5746d402. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/config/metadata/type.go:70

}

func (t *NonEmptyStringType) validate(str string) error {
	if len(strings.TrimSpace(str)) == 0 {
		return ErrStringValueIsEmpty
	}
	return nil
}

// AuthModeType ...
type AuthModeType struct {
	StringType
}

func (t *AuthModeType) validate(str string) error {
	if str == common.LDAPAuth || str == common.DBAuth || str == common.UAAAuth || str == common.HTTPAuth || str == common.OIDCAuth {
		return nil
	}
	return fmt.Errorf("invalid %s, shoud be one of %s, %s, %s, %s, %s",
		common.AUTHMode, common.DBAuth, common.LDAPAuth, common.UAAAuth, common.HTTPAuth, common.OIDCAuth)
}

// ProjectCreationRestrictionType ...
type ProjectCreationRestrictionType struct {
	StringType
}

func (t *ProjectCreationRestrictionType) validate(str string) error {
	if !(str == common.ProCrtRestrAdmOnly || str == common.ProCrtRestrEveryone) {
		return fmt.Errorf("invalid %s, should be %s or %s",
			common.ProjectCreationRestriction,
			common.ProCrtRestrAdmOnly,
			common.ProCrtRestrEveryone)
	}
	return nil
}

View on GitHub (pinned to 7b2fd08cc5)