netbirdio/netbird · error
A record is required
Error message
A record is required
What it means
validateIPv4 returns this when Type is "A" and Content is the empty string. The wording is legacy (the //nolint:staticcheck on the line acknowledges the error-string style); it means the A record's content/value is missing. It fires before the IP parse attempt.
Source
Thrown at management/internals/modules/zones/records/record.go:111
}
return nil
}
func (r *Record) EventMeta(zoneID, zoneName string) map[string]any {
return map[string]any{
"name": r.Name,
"type": string(r.Type),
"content": r.Content,
"ttl": r.TTL,
"zone_id": zoneID,
"zone_name": zoneName,
}
}
func validateIPv4(content string) error {
if content == "" {
return errors.New("A record is required") //nolint:staticcheck
}
ip := net.ParseIP(content)
if ip == nil || ip.To4() == nil {
return errors.New("A record must be a valid IPv4 address") //nolint:staticcheck
}
return nil
}
func validateIPv6(content string) error {
if content == "" {
return errors.New("AAAA record is required")
}
ip := net.ParseIP(content)
if ip == nil || ip.To4() != nil {
return errors.New("AAAA record must be a valid IPv6 address")
}
return nil
}View on GitHub (pinned to 93e97f4bf1)
Solutions
- Provide the IPv4 address in the content field, e.g. "192.0.2.1".
- Make content required client-side for every record type before calling the API.
- If you meant to leave the record valueless, that is not supported: skip creating the record instead.
Example fix
// before
{"name": "api", "type": "A", "content": ""}
// after
{"name": "api", "type": "A", "content": "192.0.2.1"} Defensive patterns
Strategy: validation
Validate before calling
if api.DNSRecordType(req.Type) == api.DNSRecordTypeA && req.Content == "" {
return fmt.Errorf("content is required for A records")
} Try / catch
if err := rec.Validate(); err != nil {
return respondBadRequest(err)
} Prevention
- Require content for every record type in the client, not just some.
- Treat empty content as a form error before submit.
When it happens
Trigger: A record body {"type":"A","content":""} or with the content key omitted; building a Record with NewRecord(..., "", ...) for an A record.
Common situations: A form that validates name and type but lets the address field submit blank; API consumers that conditionally omit fields instead of sending them; test fixtures that only set type.
Related errors
- A record must be a valid IPv4 address
- record name is required
- invalid record name format
- record type is required
- invalid CNAME target format
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/2f95430d632598dd.
Report an issue: GitHub.