{"record":{"id":"7d158a8c0e3b05bf","repo":"goharbor/harbor","slug":"s-type-error","errorCode":null,"errorMessage":"%s type error","messagePattern":"(.+?) type error","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pkg/retention/policy/rule/dayspl/evaluator.go","lineNumber":86,"sourceCode":"\n\tlog.Warningf(\"default parameter %d used for rule %s\", DefaultN, TemplateID)\n\n\treturn &evaluator{n: DefaultN}\n}\n\n// Valid ...\nfunc Valid(params rule.Parameters) error {\n\tif params != nil {\n\t\tif p, ok := params[ParameterN]; ok {\n\t\t\tif v, ok := utils.ParseJSONInt(p); ok {\n\t\t\t\tif v < 0 {\n\t\t\t\t\treturn fmt.Errorf(\"%s is less than zero\", ParameterN)\n\t\t\t\t}\n\t\t\t\tif v > 20190904 {\n\t\t\t\t\treturn fmt.Errorf(\"%s is too large\", ParameterN)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"%s type error\", ParameterN)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":68,"sourceCodeEnd":92,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/retention/policy/rule/dayspl/evaluator.go#L68-L92","documentation":"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.","triggerScenarios":"Thrown at src/pkg/retention/policy/rule/dayspl/evaluator.go:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}