goharbor/harbor · error
is less than zero
Error message
%s is less than zero
What it means
Validation guard in the latestps (latest K pushed artifacts) rule's Valid function: the 'k' count parameter parsed as a JSON integer was negative. A retained-artifact count cannot be negative, so the rule definition is rejected before it is persisted.
Solutions
- Set k to 0 or a positive integer for how many most-recently-pushed tags to keep
- Validate counts client-side before submitting the retention policy
- Only explicit negative values fail; omitting k applies a default
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/pkg/retention/policy/rule/latestps/evaluator.go:85 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/1d3aba64ec5e791c.
Report an issue: GitHub.
Appendix: source
Thrown at src/pkg/retention/policy/rule/latestps/evaluator.go:85
}
}
}
}
log.Warningf("default parameter %d used for rule %s", DefaultK, TemplateID)
return &evaluator{
k: DefaultK,
}
}
// Valid ...
func Valid(params rule.Parameters) error {
if params != nil {
if p, ok := params[ParameterK]; ok {
if v, ok := utils.ParseJSONInt(p); ok {
if v < 0 {
return fmt.Errorf("%s is less than zero", ParameterK)
}
if v >= math.MaxInt16 {
return fmt.Errorf("%s is too large", ParameterK)
}
} else {
return fmt.Errorf("%s type error", ParameterK)
}
}
}
return nil
}
View on GitHub (pinned to 7b2fd08cc5)