netbirdio/netbird · error
create chain
Error message
create chain %s: %w
What it means
NewChain failed to create the per-output NAT chain in ensureNATOutputChain. Occurs on first use of output DNAT; the chain existence was checked beforehand, so this is a genuine iptables failure rather than a duplicate.
Solutions
- Verify nat-table chain creation works as root
- Check capabilities and xtables locks
- Restart the daemon to retry lazy chain creation
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at client/firewall/iptables/router_linux.go:1054 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/3797d0be0d606ca0.
Report an issue: GitHub.
Appendix: source
Thrown at client/firewall/iptables/router_linux.go:1054
}
r.updateState()
return nil
}
// ensureNATOutputChain lazily creates the OUTPUT NAT chain and jump rule on first use.
func (r *router) ensureNATOutputChain() error {
if _, exists := r.rules[jumpNatOutput]; exists {
return nil
}
chainExists, err := r.iptablesClient.ChainExists(tableNat, chainNATOutput)
if err != nil {
return fmt.Errorf("check chain %s: %w", chainNATOutput, err)
}
if !chainExists {
if err := r.iptablesClient.NewChain(tableNat, chainNATOutput); err != nil {
return fmt.Errorf("create chain %s: %w", chainNATOutput, err)
}
}
jumpRule := []string{"-j", chainNATOutput}
if err := r.iptablesClient.Insert(tableNat, "OUTPUT", 1, jumpRule...); err != nil {
if !chainExists {
if delErr := r.iptablesClient.ClearAndDeleteChain(tableNat, chainNATOutput); delErr != nil {
log.Warnf("failed to rollback chain %s: %v", chainNATOutput, delErr)
}
}
return fmt.Errorf("add OUTPUT jump rule: %w", err)
}
r.rules[jumpNatOutput] = jumpRule
r.updateState()
return nil
}
View on GitHub (pinned to 93e97f4bf1)