goharbor/harbor · error
type error
Error message
%s type error
What it means
Type-check guard in the dayspl rule's Valid function: the 'n_days' parameter is present but utils.ParseJSONInt cannot interpret it as a JSON integer (e.g. it is a string, float, or object). The rule definition is rejected because the evaluator requires an integer count of days.
Solutions
- Send n_days as a plain JSON integer, e.g. 30, not "30" or 30.5
- Check the rule parameters map for wrongly typed values before submitting the policy
- Omit n_days entirely if you want the default window applied
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at src/pkg/retention/policy/rule/dayspl/evaluator.go:86 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/7d158a8c0e3b05bf.
Report an issue: GitHub.
Appendix: source
Thrown at src/pkg/retention/policy/rule/dayspl/evaluator.go:86
log.Warningf("default parameter %d used for rule %s", DefaultN, TemplateID)
return &evaluator{n: DefaultN}
}
// Valid ...
func Valid(params rule.Parameters) error {
if params != nil {
if p, ok := params[ParameterN]; ok {
if v, ok := utils.ParseJSONInt(p); ok {
if v < 0 {
return fmt.Errorf("%s is less than zero", ParameterN)
}
if v > 20190904 {
return fmt.Errorf("%s is too large", ParameterN)
}
} else {
return fmt.Errorf("%s type error", ParameterN)
}
}
}
return nil
}
View on GitHub (pinned to 7b2fd08cc5)