netbirdio/netbird · error
invalid record name format
Error message
invalid record name format
What it means
Validate() rejects a non-empty Name that fails shared/management/domain.IsValidDomain. That helper matches an ASCII-only regex: labels of letters/digits/hyphen (underscore only as the first character), at most 63 chars per label, an optional leading "*." wildcard, and no trailing dot. It performs no punycode conversion, so unicode domains fail as-is.
Source
Thrown at management/internals/modules/zones/records/record.go:67
Content: r.Content,
Ttl: r.TTL,
}
}
func (r *Record) FromAPIRequest(req *api.DNSRecordRequest) {
r.Name = req.Name
r.Type = RecordType(req.Type)
r.Content = req.Content
r.TTL = req.Ttl
}
func (r *Record) Validate() error {
if r.Name == "" {
return errors.New("record name is required")
}
if !domain.IsValidDomain(r.Name) {
return errors.New("invalid record name format")
}
if r.Type == "" {
return errors.New("record type is required")
}
switch r.Type {
case RecordTypeA:
if err := validateIPv4(r.Content); err != nil {
return err
}
case RecordTypeAAAA:
if err := validateIPv6(r.Content); err != nil {
return err
}
case RecordTypeCNAME:
if !domain.IsValidDomainNoWildcard(r.Content) {
return errors.New("invalid CNAME target format")View on GitHub (pinned to 93e97f4bf1)
Solutions
- Strip any trailing dot from the name before submitting ("app." -> "app").
- Convert unicode domains to punycode before sending (e.g. domain.ValidateDomains does this: "café.example.com" -> "xn--caf-dma.example.com").
- Keep each label 1-63 chars, starting and ending with a letter or digit.
Example fix
// before r.Name = "café.example.com" // after r.Name = "xn--caf-dma.example.com"
Defensive patterns
Strategy: validation
Validate before calling
if !domain.IsValidDomain(name) {
punycoded, err := domain.ValidateDomains([]string{name}) // converts unicode, then re-check
if err != nil {
return fmt.Errorf("record name %q is not a valid domain: %v", name, err)
}
name = string(punycoded[0])
} Type guard
func isValidRecordName(name string) bool {
return domain.IsValidDomain(strings.TrimSuffix(name, "."))
} Try / catch
if err := rec.Validate(); err != nil {
if err.Error() == "invalid record name format" {
// surface a field-specific message next to the name input
}
return respondBadRequest(err)
} Prevention
- Trim trailing dots from user-supplied names before submitting.
- Convert unicode input to punycode at the UI layer so the API only ever sees ASCII.
- Reuse shared/management/domain.IsValidDomain client-side for instant feedback instead of waiting for the round trip.
When it happens
Trigger: Name values like "my host" (space), "app." (trailing dot), "café.example.com" (unicode), "a..b" (empty label), "-bad.example.com" (leading hyphen), or a single label longer than 63 characters.
Common situations: Pasting a unicode domain straight from a browser bar instead of its punycode form; FQDN normalization elsewhere in the pipeline leaving a trailing dot; wildcard names are fine here (IsValidDomain allows "*."), so those pass this specific check.
Related errors
- invalid zone domain format
- record name is required
- record type is required
- 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/d69a34796abddc2a.
Report an issue: GitHub.