{"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":"Error \"create or get ipset: %w\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/firewall/iptables/router_linux.go:966 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"}