{"record":{"id":"15115d1aac857c5c","repo":"netbirdio/netbird","slug":"invalid-ip-address-skipping-firewall-rule","errorCode":null,"errorMessage":"invalid IP address, skipping firewall rule","messagePattern":"invalid IP address, skipping firewall rule","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/internal/acl/manager.go","lineNumber":426,"sourceCode":"}\n\n\n// extractRuleIP extracts the peer IP from a firewall rule.\n// If sourcePrefixes is populated (new management), decode the first entry and use its address.\n// Otherwise fall back to the deprecated PeerIP string field (old management).\nfunc extractRuleIP(r *mgmProto.FirewallRule) (netip.Addr, error) {\n\tif len(r.SourcePrefixes) > 0 {\n\t\taddr, err := netiputil.DecodeAddr(r.SourcePrefixes[0])\n\t\tif err != nil {\n\t\t\treturn netip.Addr{}, fmt.Errorf(\"decode source prefix: %w\", err)\n\t\t}\n\t\treturn addr.Unmap(), nil\n\t}\n\n\t//nolint:staticcheck // PeerIP used for backward compatibility with old management\n\taddr, err := netip.ParseAddr(r.PeerIP)\n\tif err != nil {\n\t\treturn netip.Addr{}, fmt.Errorf(\"invalid IP address, skipping firewall rule\")\n\t}\n\treturn addr.Unmap(), nil\n}\n\nfunc convertToFirewallProtocol(protocol mgmProto.RuleProtocol) (firewall.Protocol, error) {\n\tswitch protocol {\n\tcase mgmProto.RuleProtocol_TCP:\n\t\treturn firewall.ProtocolTCP, nil\n\tcase mgmProto.RuleProtocol_UDP:\n\t\treturn firewall.ProtocolUDP, nil\n\tcase mgmProto.RuleProtocol_ICMP:\n\t\treturn firewall.ProtocolICMP, nil\n\tcase mgmProto.RuleProtocol_ALL:\n\t\treturn firewall.ProtocolALL, nil\n\tdefault:\n\t\treturn firewall.ProtocolALL, fmt.Errorf(\"invalid protocol type: %s\", protocol.String())\n\t}\n}","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/internal/acl/manager.go#L408-L444","documentation":"Fallback guard in extractRuleIP: the rule has no SourcePrefixes (old management) and the deprecated PeerIP string field cannot be parsed as an IP address, so the rule's source cannot be determined. The rule is skipped rather than installed with an unknown source; the error deliberately does not embed the value.","triggerScenarios":"Thrown at client/internal/acl/manager.go:426 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Upgrade management to send SourcePrefixes","Validate PeerIP format before applying rules","Skip the rule and continue with the rest of the policy"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"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"}