{"record":{"id":"3c31e5f03b7a92c8","repo":"goharbor/harbor","slug":"quota-value-should-be-1-or-great-than-zero","errorCode":null,"errorMessage":"quota value should be -1 or great than zero","messagePattern":"quota value should be -1 or great than zero","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/config/metadata/type.go","lineNumber":232,"sourceCode":"func (t *StringToStringMapType) get(str string) (any, error) {\n\tresult := map[string]string{}\n\terr := json.Unmarshal([]byte(str), &result)\n\treturn result, err\n}\n\n// QuotaType ...\ntype QuotaType struct {\n\tInt64Type\n}\n\nfunc (t *QuotaType) validate(str string) error {\n\tval, err := parseInt64(str)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif val <= 0 && val != -1 {\n\t\treturn fmt.Errorf(\"quota value should be -1 or great than zero\")\n\t}\n\n\treturn nil\n}\n\n// DurationType ...\ntype DurationType struct {\n}\n\nfunc (t *DurationType) validate(str string) error {\n\t_, err := time.ParseDuration(str)\n\treturn err\n}\n\nfunc (t *DurationType) get(str string) (any, error) {\n\t// should not parse the duration to avoid duplicate parse.\n\treturn str, nil\n}","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/lib/config/metadata/type.go#L214-L250","documentation":"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.","triggerScenarios":"Thrown at src/lib/config/metadata/type.go:232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use -1 to denote an unlimited quota","Use a positive integer (bytes) for a limited quota","Check for a 0 or other non-positive value in the quota configuration"],"exampleFix":null,"handlingStrategy":"validation","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"}