netbirdio/netbird · error
zone name is required
Error message
zone name is required
What it means
zones.Zone.Validate() returns this when Name is empty. A Zone is hydrated from api.ZoneRequest via FromAPIRequest, so a zone create/update without a name hits it. It is the first of four checks (name present, name length, domain format, distribution groups).
Source
Thrown at management/internals/modules/zones/zone.go:70
}
}
func (z *Zone) FromAPIRequest(req *api.ZoneRequest) {
z.Name = req.Name
z.Domain = req.Domain
z.EnableSearchDomain = req.EnableSearchDomain
z.DistributionGroups = req.DistributionGroups
enabled := true
if req.Enabled != nil {
enabled = *req.Enabled
}
z.Enabled = enabled
}
func (z *Zone) Validate() error {
if z.Name == "" {
return errors.New("zone name is required")
}
if len(z.Name) > 255 {
return errors.New("zone name exceeds maximum length of 255 characters")
}
if !domain.IsValidDomainNoWildcard(z.Domain) {
return errors.New("invalid zone domain format")
}
if len(z.DistributionGroups) == 0 {
return errors.New("at least one distribution group is required")
}
return nil
}
func (z *Zone) EventMeta() map[string]any {
return map[string]any{"name": z.Name, "domain": z.Domain}View on GitHub (pinned to 93e97f4bf1)
Solutions
- Supply a non-empty zone name in the request body.
- If calling NewZone programmatically, pass a non-empty name string.
- Verify the client's field mapping against api.ZoneRequest so "name" is populated.
Example fix
// before
{"name": "", "domain": "corp.example.com", "distribution_groups": ["grp-1"]}
// after
{"name": "Corporate", "domain": "corp.example.com", "distribution_groups": ["grp-1"]} Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(req.Name) == "" {
return fmt.Errorf("zone name is required")
} Type guard
func hasZoneName(req *api.ZoneRequest) bool {
return strings.TrimSpace(req.Name) != ""
} Try / catch
if err := zone.Validate(); err != nil {
return respondBadRequest(err)
} Prevention
- Require the zone name in the creation form before enabling submit.
- Check field mapping against api.ZoneRequest when integrating a new client.
When it happens
Trigger: POST/PUT of a zone with {"name":""} or with the name key missing; building a Zone literal or calling NewZone with an empty name argument.
Common situations: Zone-creation form submitted early; a client sending the display name under a different key than the schema's "name"; automation that generates zones from templates where the name variable was unset.
Related errors
- record name is required
- record type is required
- invalid record name format
- invalid CNAME target format
- invalid record type, must be A, AAAA, or CNAME
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/2afb3557382ae1e6.
Report an issue: GitHub.