{"record":{"id":"5cd9f800a2aebad4","repo":"netbirdio/netbird","slug":"add-prefix-to-ipset-w","errorCode":null,"errorMessage":"add prefix to ipset: %w","messagePattern":"add prefix to ipset: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/firewall/iptables/router_linux.go","lineNumber":984,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"create or get ipset: %w\", err)\n\t\t}\n\n\t\treturn []string{\"-m\", \"set\", matchSet, name, direction}, nil\n\t}\n\tif network.IsPrefix() {\n\t\treturn []string{flag, network.Prefix.String()}, nil\n\t}\n\n\t// nolint:nilnil\n\treturn nil, nil\n}\n\nfunc (r *router) UpdateSet(set firewall.Set, prefixes []netip.Prefix) error {\n\tname := r.ipsetName(set.HashedName())\n\tvar merr *multierror.Error\n\tfor _, prefix := range prefixes {\n\t\tif err := r.addPrefixToIPSet(name, prefix); err != nil {\n\t\t\tmerr = multierror.Append(merr, fmt.Errorf(\"add prefix to ipset: %w\", err))\n\t\t}\n\t}\n\tif merr == nil {\n\t\tlog.Debugf(\"updated set %s with prefixes %v\", name, prefixes)\n\t}\n\n\treturn nberrors.FormatErrorOrNil(merr)\n}\n\n// AddInboundDNAT adds an inbound DNAT rule redirecting traffic from NetBird peers to local services.\nfunc (r *router) AddInboundDNAT(localAddr netip.Addr, protocol firewall.Protocol, originalPort, translatedPort uint16) error {\n\truleID := fmt.Sprintf(\"inbound-dnat-%s-%s-%d-%d\", localAddr.String(), protocol, originalPort, translatedPort)\n\n\tif _, exists := r.rules[ruleID]; exists {\n\t\treturn nil\n\t}\n\n\tdnatRule := []string{","sourceCodeStart":966,"sourceCodeEnd":1002,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/firewall/iptables/router_linux.go#L966-L1002","documentation":"Error \"add prefix to ipset: %w\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/firewall/iptables/router_linux.go:984 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"}