{"record":{"id":"d2eacc3a0c267ac5","repo":"goharbor/harbor","slug":"bad-request-d2eacc","errorCode":"BAD_REQUEST","errorMessage":"empty notification target with policy %s","messagePattern":"empty notification target with policy (.+?)","errorType":"validation","errorClass":"github.com/goharbor/harbor/src/lib/errors.Error","httpStatus":400,"severity":"error","filePath":"src/server/v2.0/handler/webhook.go","lineNumber":407,"sourceCode":"\t\tnotificationTypes.NotifyType = append(notificationTypes.NotifyType, models.NotifyType(notifyType))\n\t}\n\n\tfor _, eventType := range notification.GetSupportedEventTypes() {\n\t\tnotificationTypes.EventType = append(notificationTypes.EventType, models.EventType(eventType))\n\t}\n\t// currently only http type support payload format\n\thttpPayloadFormats := &models.PayloadFormat{NotifyType: models.NotifyType(\"http\")}\n\tfor _, formatType := range notification.GetSupportedPayloadFormats() {\n\t\thttpPayloadFormats.Formats = append(httpPayloadFormats.Formats, models.PayloadFormatType(formatType))\n\t}\n\tnotificationTypes.PayloadFormats = []*models.PayloadFormat{httpPayloadFormats}\n\n\treturn webhook.NewGetSupportedEventTypesOK().WithPayload(notificationTypes)\n}\n\nfunc (n *webhookAPI) validateTargets(policy *policy_model.Policy) (bool, error) {\n\tif len(policy.Targets) == 0 {\n\t\treturn false, errors.New(nil).WithMessagef(\"empty notification target with policy %s\", policy.Name).WithCode(errors.BadRequestCode)\n\t}\n\tfor i, target := range policy.Targets {\n\t\turl, err := utils.ParseEndpoint(target.Address)\n\t\tif err != nil {\n\t\t\treturn false, errors.New(err).WithCode(errors.BadRequestCode)\n\t\t}\n\t\t// Prevent SSRF security issue #3755\n\t\ttarget.Address = url.Scheme + \"://\" + url.Host + url.Path\n\n\t\tif !isNotifyTypeSupported(target.Type) {\n\t\t\treturn false, errors.New(nil).WithMessagef(\"unsupported target type %s with policy %s\", target.Type, policy.Name).WithCode(errors.BadRequestCode)\n\t\t}\n\t\t// don't allow set the payload format for slack type\n\t\t// slack should be migrated as a kind of payload in the future\n\t\tif len(target.PayloadFormat) > 0 && target.Type == \"slack\" {\n\t\t\treturn false, errors.New(nil).WithMessage(\"set payload format is not allowed for slack\").WithCode(errors.BadRequestCode)\n\t\t}\n","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/server/v2.0/handler/webhook.go#L389-L425","documentation":"Error \"empty notification target with policy %s\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/server/v2.0/handler/webhook.go:407 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"}