{"record":{"id":"3d99ac2c743f6bd3","repo":"goharbor/harbor","slug":"the-name-of-namespace-cannot-be-null","errorCode":null,"errorMessage":"the name of namespace cannot be null","messagePattern":"the name of namespace cannot be null","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pkg/reg/adapter/dtr/adapter.go","lineNumber":165,"sourceCode":"}\n\n// PrepareForPush creates docker repository in DTR\nfunc (a *adapter) PrepareForPush(resources []*model.Resource) error {\n\tvar dtrNamespaces []Account\n\tvar repos []string\n\tnamespaces := make(map[string]string)\n\tfor _, resource := range resources {\n\t\tif resource == nil {\n\t\t\treturn errors.New(\"the resource cannot be null\")\n\t\t}\n\t\tif resource.Metadata == nil {\n\t\t\treturn errors.New(\"the metadata of resource cannot be null\")\n\t\t}\n\t\tif resource.Metadata.Repository == nil {\n\t\t\treturn errors.New(\"the namespace of resource cannot be null\")\n\t\t}\n\t\tif len(resource.Metadata.Repository.Name) == 0 {\n\t\t\treturn errors.New(\"the name of namespace cannot be null\")\n\t\t}\n\t\tpath := strings.Split(resource.Metadata.Repository.Name, \"/\")\n\t\tif len(path) > 0 {\n\t\t\tnamespaces[path[0]] = path[0]\n\t\t}\n\t\tif len(resource.Metadata.Repository.Name) > 0 {\n\t\t\trepos = append(repos, resource.Metadata.Repository.Name)\n\t\t}\n\t}\n\n\tdtrNamespaces, err := a.clientDTRAPI.getNamespaces()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to lookup namespaces from DTR: %v\", err)\n\t\treturn err\n\t}\n\n\texistingNamespaces := make(map[string]struct{})\n\tfor _, namespace := range dtrNamespaces {","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/reg/adapter/dtr/adapter.go#L147-L183","documentation":"Error \"the name of namespace cannot be null\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/pkg/reg/adapter/dtr/adapter.go:165 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"}