goharbor/harbor · error

quota value should be -1 or great than zero

Error message

quota value should be -1 or great than zero

What it means

Validation in config QuotaType.validate: the quota value is <= 0 and not exactly -1, but only -1 (unlimited) or a positive number are legal quota settings.

Solutions

  1. Use -1 to denote an unlimited quota
  2. Use a positive integer (bytes) for a limited quota
  3. Check for a 0 or other non-positive value in the quota configuration
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

func (t *StringToStringMapType) get(str string) (any, error) {
	result := map[string]string{}
	err := json.Unmarshal([]byte(str), &result)
	return result, err
}

// QuotaType ...
type QuotaType struct {
	Int64Type
}

func (t *QuotaType) validate(str string) error {
	val, err := parseInt64(str)
	if err != nil {
		return err
	}

	if val <= 0 && val != -1 {
		return fmt.Errorf("quota value should be -1 or great than zero")
	}

	return nil
}

// DurationType ...
type DurationType struct {
}

func (t *DurationType) validate(str string) error {
	_, err := time.ParseDuration(str)
	return err
}

func (t *DurationType) get(str string) (any, error) {
	// should not parse the duration to avoid duplicate parse.
	return str, nil
}

View on GitHub (pinned to 7b2fd08cc5)