{"record":{"id":"5752bed910736c32","repo":"goharbor/harbor","slug":"bad-request-5752be","errorCode":"BAD_REQUEST","errorMessage":"err.Error()","messagePattern":"err\\.Error\\(\\)","errorType":"validation","errorClass":"errors.Error","httpStatus":400,"severity":"error","filePath":"src/server/v2.0/handler/registry.go","lineNumber":59,"sourceCode":"type registryAPI struct {\n\tBaseAPI\n\tctl registry.Controller\n}\n\nfunc (r *registryAPI) CreateRegistry(ctx context.Context, params operation.CreateRegistryParams) middleware.Responder {\n\tif err := r.RequireSystemAccess(ctx, rbac.ActionCreate, rbac.ResourceRegistry); err != nil {\n\t\treturn r.SendError(ctx, err)\n\t}\n\tregistry := &model.Registry{\n\t\tName:        params.Registry.Name,\n\t\tDescription: params.Registry.Description,\n\t\tType:        params.Registry.Type,\n\t\tURL:         params.Registry.URL,\n\t\tInsecure:    params.Registry.Insecure,\n\t}\n\tif params.Registry.CaCertificate != nil {\n\t\tif err := commonhttp.ValidateCACertificate(*params.Registry.CaCertificate); err != nil {\n\t\t\treturn r.SendError(ctx, errors.New(nil).WithCode(errors.BadRequestCode).WithMessage(err.Error()))\n\t\t}\n\t\tregistry.CACertificate = *params.Registry.CaCertificate\n\t}\n\tif params.Registry.Credential != nil {\n\t\tregistry.Credential = &model.Credential{\n\t\t\tType:         params.Registry.Credential.Type,\n\t\t\tAccessKey:    params.Registry.Credential.AccessKey,\n\t\t\tAccessSecret: params.Registry.Credential.AccessSecret,\n\t\t}\n\t}\n\n\tid, err := r.ctl.Create(ctx, registry)\n\tif err != nil {\n\t\treturn r.SendError(ctx, err)\n\t}\n\tlocation := fmt.Sprintf(\"%s/%d\", strings.TrimSuffix(params.HTTPRequest.URL.Path, \"/\"), id)\n\treturn operation.NewCreateRegistryCreated().WithLocation(location)\n}","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/server/v2.0/handler/registry.go#L41-L77","documentation":"Error \"err.Error()\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/server/v2.0/handler/registry.go:59 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"}