{"record":{"id":"4f027f89dd7998cb","repo":"netbirdio/netbird","slug":"service-name-is-required","errorCode":null,"errorMessage":"service name is required","messagePattern":"service name is required","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"management/internals/modules/reverseproxy/service/service.go","lineNumber":857,"sourceCode":"\nfunc restrictionsToProto(r AccessRestrictions) *proto.AccessRestrictions {\n\tif len(r.AllowedCIDRs) == 0 && len(r.BlockedCIDRs) == 0 &&\n\t\tlen(r.AllowedCountries) == 0 && len(r.BlockedCountries) == 0 &&\n\t\tr.CrowdSecMode == \"\" {\n\t\treturn nil\n\t}\n\treturn &proto.AccessRestrictions{\n\t\tAllowedCidrs:     r.AllowedCIDRs,\n\t\tBlockedCidrs:     r.BlockedCIDRs,\n\t\tAllowedCountries: r.AllowedCountries,\n\t\tBlockedCountries: r.BlockedCountries,\n\t\tCrowdsecMode:     r.CrowdSecMode,\n\t}\n}\n\nfunc (s *Service) Validate() error {\n\tif s.Name == \"\" {\n\t\treturn errors.New(\"service name is required\")\n\t}\n\tif len(s.Name) > 255 {\n\t\treturn errors.New(\"service name exceeds maximum length of 255 characters\")\n\t}\n\n\tif len(s.Targets) == 0 {\n\t\treturn errors.New(\"at least one target is required\")\n\t}\n\n\tif s.Mode == \"\" {\n\t\ts.Mode = ModeHTTP\n\t}\n\n\tif err := validateHeaderAuths(s.Auth.HeaderAuths); err != nil {\n\t\treturn err\n\t}\n\tif err := validateAccessRestrictions(&s.Restrictions); err != nil {\n\t\treturn err","sourceCodeStart":839,"sourceCodeEnd":875,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/management/internals/modules/reverseproxy/service/service.go#L839-L875","documentation":"Returned by Service.Validate for the reverse-proxy module (management/internals/modules/reverseproxy/service/service.go:857). Every reverse-proxy service must carry a non-empty Name before any other validation runs; an empty name makes the service unaddressable in management state and is rejected immediately.","triggerScenarios":"Creating or updating a reverse-proxy service via the management API with Name omitted (empty string) in the request payload.","commonSituations":"Client code building the service object field-by-field and forgetting Name; JSON payloads using a wrong key (e.g. 'title') so Name decodes as empty; UI create form submitted without the name input.","solutions":["Set a non-empty Name in the create/update request.","Validate the request payload client-side before calling the API.","Check the field mapping between your payload keys and the Service struct (json tags) if you believe you set it."],"exampleFix":"# before\n{\"targets\": [\"http://10.0.0.5:8080\"], \"mode\": \"http\"}\n\n# after\n{\"name\": \"internal-api\", \"targets\": [\"http://10.0.0.5:8080\"], \"mode\": \"http\"}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(svc.Name) == \"\" {\n    return fmt.Errorf(\"service name is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate required fields (name, domain, targets) client-side before calling the API.","Check your payload's json key names decode into the Service struct correctly."],"tags":["go","netbird","management","reverse-proxy","validation"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}