netbirdio/netbird · error

invalid action type

Error message

invalid action type: %d

What it means

A default-branch validation guard in convertFirewallAction: the RuleAction enum value sent by Management in the network map does not match ACCEPT or DROP, so it cannot be mapped to a firewall.Action. It fires when an agent speaks an older/newer proto than the management service and receives an action constant it does not recognize; the offending value is the unmapped mgmProto.RuleAction enum.

Solutions

  1. Update the agent to a version whose management proto definitions include the new RuleAction value
  2. Check that the management service and agent run compatible releases; downgrade or upgrade one side so the enum sets match
  3. If a custom/patched build is involved, verify the mgmProto.RuleAction enum was not extended without regenerating client protos
  4. Report the unknown action value (logged via %d) to identify which proto version introduced it
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

	case mgmProto.RuleProtocol_ALL:
		return firewall.ProtocolALL, nil
	default:
		return firewall.ProtocolALL, fmt.Errorf("invalid protocol type: %s", protocol.String())
	}
}

func shouldSkipInvertedRule(protocol firewall.Protocol, port *firewall.Port) bool {
	return protocol == firewall.ProtocolALL || protocol == firewall.ProtocolICMP || port == nil
}

func convertFirewallAction(action mgmProto.RuleAction) (firewall.Action, error) {
	switch action {
	case mgmProto.RuleAction_ACCEPT:
		return firewall.ActionAccept, nil
	case mgmProto.RuleAction_DROP:
		return firewall.ActionDrop, nil
	default:
		return firewall.ActionDrop, fmt.Errorf("invalid action type: %d", action)
	}
}

func convertPortInfo(portInfo *mgmProto.PortInfo) *firewall.Port {
	if portInfo == nil {
		return nil
	}

	if portInfo.GetPort() != 0 {
		return &firewall.Port{
			Values: []uint16{uint16(int(portInfo.GetPort()))},
		}
	}

	if portInfo.GetRange() != nil {
		return &firewall.Port{
			IsRange: true,
			Values:  []uint16{uint16(portInfo.GetRange().Start), uint16(portInfo.GetRange().End)},

View on GitHub (pinned to 93e97f4bf1)