{"record":{"id":"c1e37014f5c6d29e","repo":"netbirdio/netbird","slug":"delete-w","errorCode":null,"errorMessage":"delete: %w","messagePattern":"delete: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/firewall/nftables/router_linux.go","lineNumber":528,"sourceCode":"\n\truleKey := rule.ID()\n\tnftRule, exists := r.rules[ruleKey]\n\tif !exists {\n\t\tlog.Debugf(\"route rule %s not found\", ruleKey)\n\t\treturn nil\n\t}\n\n\tif nftRule.Handle == 0 {\n\t\tlog.Warnf(\"route rule %s has no handle, removing stale entry\", ruleKey)\n\t\tif err := r.decrementSetCounter(nftRule); err != nil {\n\t\t\tlog.Warnf(\"decrement set counter for stale rule %s: %v\", ruleKey, err)\n\t\t}\n\t\tdelete(r.rules, ruleKey)\n\t\treturn nil\n\t}\n\n\tif err := r.deleteNftRule(nftRule, ruleKey); err != nil {\n\t\treturn fmt.Errorf(\"delete: %w\", err)\n\t}\n\n\tif err := r.conn.Flush(); err != nil {\n\t\treturn fmt.Errorf(flushError, err)\n\t}\n\n\tif err := r.decrementSetCounter(nftRule); err != nil {\n\t\treturn fmt.Errorf(\"decrement set counter: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (r *router) createIpSet(setName string, input setInput) (*nftables.Set, error) {\n\t// overlapping prefixes will result in an error, so we need to merge them\n\tprefixes := firewall.MergeIPRanges(input.prefixes)\n\n\tnfset := &nftables.Set{","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/firewall/nftables/router_linux.go#L510-L546","documentation":"deleteNftRule failed to remove the nftables rule (by handle) backing a routing rule in DeleteRule. The in-memory entry is kept only on success, so on this error the kernel still contains the rule and the caller should treat the routing rule as still enforced; a subsequent conn.Flush failure is reported separately.","triggerScenarios":"Thrown at client/firewall/nftables/router_linux.go:528 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Refresh the rules map and retry","Treat NotFound as success and clean the cached entry","Avoid concurrent external nftables edits while the agent runs"],"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"}