{"record":{"id":"c1d2016e9a391676","repo":"goharbor/harbor","slug":"resources-is-negative-for-resource-s-s","errorCode":null,"errorMessage":"resources is negative for resource(s): %s","messagePattern":"resources is negative for resource\\(s\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/controller/quota/controller.go","lineNumber":504,"sourceCode":"\nfunc reserveResources(resources types.ResourceList) func(hardLimits, used types.ResourceList) (types.ResourceList, error) {\n\treturn func(hardLimits, used types.ResourceList) (types.ResourceList, error) {\n\t\tnewUsed := types.Add(used, resources)\n\n\t\tif err := quota.IsSafe(hardLimits, used, newUsed, false); err != nil {\n\t\t\treturn nil, errors.DeniedError(err).WithMessagef(\"Quota exceeded when processing the request of %v\", err)\n\t\t}\n\n\t\treturn newUsed, nil\n\t}\n}\n\nfunc rollbackResources(resources types.ResourceList) func(hardLimits, used types.ResourceList) (types.ResourceList, error) {\n\treturn func(_, used types.ResourceList) (types.ResourceList, error) {\n\t\tnewUsed := types.Subtract(used, resources)\n\t\t// ensure that new used is never negative\n\t\tif negativeUsed := types.IsNegative(newUsed); len(negativeUsed) > 0 {\n\t\t\treturn nil, fmt.Errorf(\"resources is negative for resource(s): %s\", quota.PrettyPrintResourceNames(negativeUsed))\n\t\t}\n\n\t\treturn newUsed, nil\n\t}\n}\n\nfunc refreshResources(calculateUsage func() (types.ResourceList, error), ignoreLimitation bool) func(hardLimits, used types.ResourceList) (types.ResourceList, error) {\n\treturn func(hardLimits, used types.ResourceList) (types.ResourceList, error) {\n\t\tnewUsed, err := calculateUsage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// ensure that new used is never negative\n\t\tif negativeUsed := types.IsNegative(newUsed); len(negativeUsed) > 0 {\n\t\t\treturn nil, fmt.Errorf(\"quota usage is negative for resource(s): %s\", quota.PrettyPrintResourceNames(negativeUsed))\n\t\t}\n","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/quota/controller.go#L486-L522","documentation":"Error \"resources is negative for resource(s): %s\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/controller/quota/controller.go:504 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}