{"record":{"id":"06d5058f1ffb49dd","repo":"netbirdio/netbird","slug":"aaaa-record-is-required","errorCode":null,"errorMessage":"AAAA record is required","messagePattern":"AAAA record is required","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"management/internals/modules/zones/records/record.go","lineNumber":122,"sourceCode":"\t\t\"zone_id\":   zoneID,\n\t\t\"zone_name\": zoneName,\n\t}\n}\n\nfunc validateIPv4(content string) error {\n\tif content == \"\" {\n\t\treturn errors.New(\"A record is required\") //nolint:staticcheck\n\t}\n\tip := net.ParseIP(content)\n\tif ip == nil || ip.To4() == nil {\n\t\treturn errors.New(\"A record must be a valid IPv4 address\") //nolint:staticcheck\n\t}\n\treturn nil\n}\n\nfunc validateIPv6(content string) error {\n\tif content == \"\" {\n\t\treturn errors.New(\"AAAA record is required\")\n\t}\n\tip := net.ParseIP(content)\n\tif ip == nil || ip.To4() != nil {\n\t\treturn errors.New(\"AAAA record must be a valid IPv6 address\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":104,"sourceCodeEnd":130,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/management/internals/modules/zones/records/record.go#L104-L130","documentation":"Guard in validateIPv6: an AAAA record entry was supplied with empty content. The zones record validator requires a non-empty string before it attempts net.ParseIP, so this fires only when the record's content field is blank, not when the address is malformed (that produces the 'valid IPv6 address' error instead).","triggerScenarios":"A record body {\"type\":\"AAAA\",\"content\":\"\"} or with the content field omitted entirely.","commonSituations":"Form submits where only the type dropdown was set; clients that omit empty optional-looking fields rather than sending values; migration scripts that skip AAAA values when none exist but still emit the record.","solutions":["Provide the IPv6 address in the content field, e.g. \"2001:db8::1\".","Require content client-side for all record types.","Skip emitting AAAA records entirely in migration scripts when the source has no IPv6 value."],"exampleFix":"// before\n{\"name\": \"api\", \"type\": \"AAAA\", \"content\": \"\"}\n// after\n{\"name\": \"api\", \"type\": \"AAAA\", \"content\": \"2001:db8::1\"}","handlingStrategy":"validation","validationCode":"if api.DNSRecordType(req.Type) == api.DNSRecordTypeAAAA && req.Content == \"\" {\n    return fmt.Errorf(\"content is required for AAAA records\")\n}","typeGuard":null,"tryCatchPattern":"if err := rec.Validate(); err != nil {\n    return respondBadRequest(err)\n}","preventionTips":["Require content for every record type in the client.","Skip AAAA records in migrations when the source has no IPv6 value."],"tags":["dns","zones","validation","ipv6"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}