goharbor/harbor · error

invalid scope, should be

Error message

invalid scope, should be %d, %d or %d

What it means

LdapScopeType.validate rejected the ldap_scope setting because it is not one of the string forms '0', '1' or '2', which map to LDAPScopeBase, LDAPScopeOnelevel and LDAPScopeSubtree; the message prints the numeric constants (0, 1, 2).

Solutions

  1. Set ldap_scope to 0 (base), 1 (onelevel) or 2 (subtree)
  2. Check that the value was not quoted or given as a float string
  3. Re-apply the LDAP configuration once corrected
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

	if val > 65535 {
		return fmt.Errorf("network port should be less than 65535")
	}

	return err
}

// LdapScopeType - The LDAP scope is a int type, but its is limit to 0, 1, 2
type LdapScopeType struct {
	IntType
}

// validate - Verify the range is limited
func (t *LdapScopeType) validate(str string) error {
	if str == "0" || str == "1" || str == "2" {
		return nil
	}
	return fmt.Errorf("invalid scope, should be %d, %d or %d",
		common.LDAPScopeBase,
		common.LDAPScopeOnelevel,
		common.LDAPScopeSubtree)
}

// Int64Type ...
type Int64Type struct {
}

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

func (t *Int64Type) get(str string) (any, error) {
	return parseInt64(str)
}

View on GitHub (pinned to 7b2fd08cc5)