goharbor/harbor · error

invalid , should be or

Error message

invalid %s, should be %s or %s

What it means

ProjectCreationRestrictionType.validate rejected the project_creation_restriction setting because it matches neither 'adminonly' nor 'everyone', the only two permitted values for controlling who may create projects.

Solutions

  1. Set project_creation_restriction to 'adminonly' or 'everyone'
  2. Verify the value in harbor.yml or the configuration update payload for typos
  3. Re-submit the configuration change once corrected
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

	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
}

// IntType ..
type IntType struct {
}

func (t *IntType) validate(str string) error {
	_, err := parseInt(str)
	return err
}

func (t *IntType) get(str string) (any, error) {
	return parseInt(str)

View on GitHub (pinned to 7b2fd08cc5)