netbirdio/netbird · error

refresh v4 rules

Error message

refresh v4 rules: %w

What it means

routerForRuleID fell through to the kernel-refresh path and refreshing the v4 router's cached rules from nftables failed. Happens when the cached rule maps disagree with the lookup; the refresh is the one-shot resync before falling back to v4.

Solutions

  1. Check nftables readability with 'nft list ruleset'
  2. Restart the daemon to rebuild rule caches from scratch
  3. If it recurs, capture which rule id triggered the refresh path
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/firewall/nftables/manager_linux.go:357 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/b756295df4ef152f. Report an issue: GitHub.

Appendix: source

Thrown at client/firewall/nftables/manager_linux.go:357

	}
	return r.DeleteRouteRule(rule)
}

// routerForRuleID picks the router holding the rule with the given id, using
// the supplied lookup. If the cached maps disagree (or both miss), it refreshes
// from the kernel once and re-checks before falling back to the v4 router.
func (m *Manager) routerForRuleID(id string, has func(*router, string) bool) (*router, error) {
	if has(m.router, id) {
		return m.router, nil
	}
	if m.hasIPv6() && has(m.router6, id) {
		return m.router6, nil
	}
	if !m.hasIPv6() {
		return m.router, nil
	}
	if err := m.router.refreshRulesMap(); err != nil {
		return nil, fmt.Errorf("refresh v4 rules: %w", err)
	}
	if err := m.router6.refreshRulesMap(); err != nil {
		return nil, fmt.Errorf("refresh v6 rules: %w", err)
	}
	if has(m.router6, id) && !has(m.router, id) {
		return m.router6, nil
	}
	return m.router, nil
}

func (m *Manager) IsServerRouteSupported() bool {
	return true
}

func (m *Manager) IsStateful() bool {
	return true
}

View on GitHub (pinned to 93e97f4bf1)