{"record":{"id":"96d9d0879f84b5e2","repo":"goharbor/harbor","slug":"precondition-96d9d0","errorCode":"PRECONDITION","errorMessage":"the project contains repositories, can not be deleted","messagePattern":"the project contains repositories, can not be deleted","errorType":"error_code","errorClass":"*errors.Error","httpStatus":412,"severity":"error","filePath":"src/server/v2.0/handler/project.go","lineNumber":280,"sourceCode":"\t\tlocation = fmt.Sprintf(\"%s/%d\", strings.TrimSuffix(params.HTTPRequest.URL.Path, \"/\"), projectID)\n\t}\n\n\treturn operation.NewCreateProjectCreated().WithLocation(location)\n}\n\nfunc (a *projectAPI) DeleteProject(ctx context.Context, params operation.DeleteProjectParams) middleware.Responder {\n\tprojectNameOrID := parseProjectNameOrID(params.ProjectNameOrID, params.XIsResourceName)\n\tif err := a.RequireProjectAccess(ctx, projectNameOrID, rbac.ActionDelete); err != nil {\n\t\treturn a.SendError(ctx, err)\n\t}\n\n\tp, result, err := a.deletable(ctx, projectNameOrID)\n\tif err != nil {\n\t\treturn a.SendError(ctx, err)\n\t}\n\n\tif !result.Deletable {\n\t\treturn a.SendError(ctx, errors.PreconditionFailedError(errors.New(result.Message)))\n\t}\n\n\tif err := a.projectCtl.Delete(ctx, p.ProjectID); err != nil {\n\t\treturn a.SendError(ctx, err)\n\t}\n\n\t// remove the robot associated with the project\n\tif err := a.robotMgr.DeleteByProjectID(ctx, p.ProjectID); err != nil {\n\t\treturn a.SendError(ctx, err)\n\t}\n\n\treferenceID := quota.ReferenceID(p.ProjectID)\n\tq, err := a.quotaCtl.GetByRef(ctx, quota.ProjectReference, referenceID)\n\tif err != nil {\n\t\tlog.Warningf(\"failed to get quota for project %s, error: %v\", projectNameOrID, err)\n\t} else {\n\t\tif err := a.quotaCtl.Delete(ctx, q.ID); err != nil {\n\t\t\treturn a.SendError(ctx, fmt.Errorf(\"failed to delete quota for project: %v\", err))","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/server/v2.0/handler/project.go#L262-L298","documentation":"Error \"the project contains repositories, can not be deleted\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/server/v2.0/handler/project.go:280 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"}