{"record":{"id":"b771b62b7f8d72b4","repo":"goharbor/harbor","slug":"check-existence-of-namespace-s-error-v","errorCode":null,"errorMessage":"check existence of namespace '%s' error: %v","messagePattern":"check existence of namespace '(.+?)' error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pkg/reg/adapter/dockerhub/adapter.go","lineNumber":191,"sourceCode":"\tif resp.StatusCode/100 != 2 {\n\t\tlog.Errorf(\"list namespace error: %s\", string(body))\n\t\treturn nil, fmt.Errorf(\"%s\", string(body))\n\t}\n\n\tnamespaces := NamespacesResp{}\n\terr = json.Unmarshal(body, &namespaces)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Debugf(\"got namespaces %v by calling the listing namespaces API\", namespaces)\n\treturn namespaces.Namespaces, nil\n}\n\n// CreateNamespace creates a new namespace in DockerHub\nfunc (a *adapter) CreateNamespace(namespace *model.Namespace) error {\n\tns, err := a.getNamespace(namespace.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"check existence of namespace '%s' error: %v\", namespace.Name, err)\n\t}\n\n\t// If the namespace already exist, return succeeded directly.\n\tif ns != nil {\n\t\tlog.Infof(\"Namespace %s already exist in DockerHub, skip it.\", namespace.Name)\n\t\treturn nil\n\t}\n\n\treq := &NewOrgReq{\n\t\tName:     namespace.Name,\n\t\tFullName: namespace.GetStringMetadata(metadataKeyFullName, namespace.Name),\n\t\tCompany:  namespace.GetStringMetadata(metadataKeyCompany, namespace.Name),\n\t}\n\tb, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/reg/adapter/dockerhub/adapter.go#L173-L209","documentation":"Error \"check existence of namespace '%s' error: %v\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/pkg/reg/adapter/dockerhub/adapter.go:191 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"}