netbirdio/netbird · error

invalid direction, skipping firewall rule

Error message

invalid direction, skipping firewall rule

What it means

Guard in the peer-rule conversion: the management firewall rule's Direction is neither IN nor OUT (an unknown proto enum value). The rule is neither installed nor cached — the error is returned with empty IDs so the caller skips it while continuing with other rules, since installing it with a guessed direction would be unsafe.

Solutions

  1. Check the proto enum value sent by management
  2. Upgrade the management server
  3. Skip unknown directions and continue applying the policy
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/internal/acl/manager.go:327 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/49e73ba468fa9eb3. Report an issue: GitHub.

Appendix: source

Thrown at client/internal/acl/manager.go:327

	}

	ruleID := d.getPeerRuleID(ip, protocol, int(r.Direction), port, action)
	if rulesPair, ok := d.peerRulesPairs[ruleID]; ok {
		return ruleID, rulesPair, nil
	}

	var rules []firewall.Rule
	switch r.Direction {
	case mgmProto.RuleDirection_IN:
		rules, err = d.addInRules(r.PolicyID, ip, protocol, port, action, ipsetName)
	case mgmProto.RuleDirection_OUT:
		if d.firewall.IsStateful() {
			return "", nil, nil
		}
		// return traffic for outbound connections if firewall is stateless
		rules, err = d.addOutRules(r.PolicyID, ip, protocol, port, action, ipsetName)
	default:
		return "", nil, fmt.Errorf("invalid direction, skipping firewall rule")
	}

	if err != nil {
		return "", nil, err
	}

	return ruleID, rules, nil
}

func portInfoEmpty(portInfo *mgmProto.PortInfo) bool {
	if portInfo == nil {
		return true
	}

	switch portInfo.GetPortSelection().(type) {
	case *mgmProto.PortInfo_Port:
		return portInfo.GetPort() == 0
	case *mgmProto.PortInfo_Range_:

View on GitHub (pinned to 93e97f4bf1)