{"record":{"id":"d61b2f4ac7fe3591","repo":"netbirdio/netbird","slug":"decode-source-prefix-w","errorCode":null,"errorMessage":"decode source prefix: %w","messagePattern":"decode source prefix: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/internal/acl/manager.go","lineNumber":418,"sourceCode":"\t}\n\n\treturn id.RuleID(hex.EncodeToString(md5.New().Sum([]byte(idStr))))\n}\n\n// getRuleGroupingSelector takes all rule properties except IP address to build selector\nfunc (d *DefaultManager) getRuleGroupingSelector(rule *mgmProto.FirewallRule) string {\n\treturn fmt.Sprintf(\"%v:%v:%v:%s:%v\", strconv.Itoa(int(rule.Direction)), rule.Action, rule.Protocol, rule.Port, rule.PortInfo)\n}\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","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/internal/acl/manager.go#L400-L436","documentation":"Error \"decode source prefix: %w\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/internal/acl/manager.go:418 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}