{"record":{"id":"bc3a1e628f0658cf","repo":"netbirdio/netbird","slug":"create-or-get-ipset-w","errorCode":null,"errorMessage":"create or get ipset: %w","messagePattern":"create or get ipset: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/firewall/iptables/router_linux.go","lineNumber":966,"sourceCode":"\t\trule = append(rule, applyPort(\"--sport\", params.SPort)...)\n\t\trule = append(rule, applyPort(\"--dport\", params.DPort)...)\n\t}\n\n\trule = append(rule, \"-j\", actionToStr(params.Action))\n\n\treturn rule, nil\n}\n\nfunc (r *router) applyNetwork(flag string, network firewall.Network, prefixes []netip.Prefix) ([]string, error) {\n\tdirection := \"src\"\n\tif flag == \"-d\" {\n\t\tdirection = \"dst\"\n\t}\n\n\tif network.IsSet() {\n\t\tname := r.ipsetName(network.Set.HashedName())\n\t\tif _, err := r.ipsetCounter.Increment(name, prefixes); err != nil {\n\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))","sourceCodeStart":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/firewall/iptables/router_linux.go#L948-L984","documentation":"While building an iptables rule that references a network set, incrementing the ipset reference counter (which creates the ipset or updates its membership for the given prefixes) failed. Without the ipset the generated rule would match nothing or iptables would reject the set reference, so rule construction is aborted and the caller must not append the partially built rule.","triggerScenarios":"Thrown at client/firewall/iptables/router_linux.go:966 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify ipset kernel module and tooling are available","Check daemon capabilities","Retry after restarting the daemon"],"exampleFix":null,"handlingStrategy":"retry","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"}