netbirdio/netbird · error

service name is required

Error message

service name is required

What it means

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.

Source

Thrown at management/internals/modules/reverseproxy/service/service.go:857

func restrictionsToProto(r AccessRestrictions) *proto.AccessRestrictions {
	if len(r.AllowedCIDRs) == 0 && len(r.BlockedCIDRs) == 0 &&
		len(r.AllowedCountries) == 0 && len(r.BlockedCountries) == 0 &&
		r.CrowdSecMode == "" {
		return nil
	}
	return &proto.AccessRestrictions{
		AllowedCidrs:     r.AllowedCIDRs,
		BlockedCidrs:     r.BlockedCIDRs,
		AllowedCountries: r.AllowedCountries,
		BlockedCountries: r.BlockedCountries,
		CrowdsecMode:     r.CrowdSecMode,
	}
}

func (s *Service) Validate() error {
	if s.Name == "" {
		return errors.New("service name is required")
	}
	if len(s.Name) > 255 {
		return errors.New("service name exceeds maximum length of 255 characters")
	}

	if len(s.Targets) == 0 {
		return errors.New("at least one target is required")
	}

	if s.Mode == "" {
		s.Mode = ModeHTTP
	}

	if err := validateHeaderAuths(s.Auth.HeaderAuths); err != nil {
		return err
	}
	if err := validateAccessRestrictions(&s.Restrictions); err != nil {
		return err

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Set a non-empty Name in the create/update request.
  2. Validate the request payload client-side before calling the API.
  3. Check the field mapping between your payload keys and the Service struct (json tags) if you believe you set it.

Example fix

# before
{"targets": ["http://10.0.0.5:8080"], "mode": "http"}

# after
{"name": "internal-api", "targets": ["http://10.0.0.5:8080"], "mode": "http"}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(svc.Name) == "" {
    return fmt.Errorf("service name is required")
}

Prevention

When it happens

Trigger: Creating or updating a reverse-proxy service via the management API with Name omitted (empty string) in the request payload.

Common situations: 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.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/4f027f89dd7998cb. Report an issue: GitHub.