netbirdio/netbird · error

clear and delete chain

Error message

clear and delete chain: %w

What it means

ClearAndDeleteChain failed for the NetBird raw chain during cleanup, after the jump rules were already removed. Some rules may remain in the chain; rawSupported is still set false so the manager no longer claims support.

Solutions

  1. Flush and delete the chain manually: 'iptables -t raw -F <chain> && iptables -t raw -X <chain>'
  2. Reboot clears residual raw-table state
  3. Address the underlying iptables failure
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at client/firewall/iptables/manager_linux.go:642 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/cfe2df03f67a32f1. Report an issue: GitHub.

Appendix: source

Thrown at client/firewall/iptables/manager_linux.go:642

		}
		return fmt.Errorf("check chain exists: %w", err)
	}
	if !exists {
		return nil
	}

	jumpRule := []string{"-j", chainNameRaw}

	if err := m.ipv4Client.DeleteIfExists(tableRaw, chainOUTPUT, jumpRule...); err != nil {
		return fmt.Errorf("remove output jump rule: %w", err)
	}

	if err := m.ipv4Client.DeleteIfExists(tableRaw, chainPREROUTING, jumpRule...); err != nil {
		return fmt.Errorf("remove prerouting jump rule: %w", err)
	}

	if err := m.ipv4Client.ClearAndDeleteChain(tableRaw, chainNameRaw); err != nil {
		return fmt.Errorf("clear and delete chain: %w", err)
	}

	m.rawSupported = false
	return nil
}

func getConntrackEstablished() []string {
	return []string{"-m", "conntrack", "--ctstate", "RELATED,ESTABLISHED", "-j", "ACCEPT"}
}

View on GitHub (pinned to 93e97f4bf1)