netbirdio/netbird · error
invalid protocol type
Error message
invalid protocol type: %s
What it means
convertToFirewallProtocol received a management RuleProtocol enum value outside the known set (TCP, UDP, ICMP, ALL). Returning ProtocolALL with this error lets the caller skip the rule — mapping an unknown protocol to ALL would silently widen the rule, so the default case fails instead.
Solutions
- Skip rules with unrecognized protocols
- Align client with the management protocol version
- Add support for the new protocol value
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at client/internal/acl/manager.go:442 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/d836244dc96be02b.
Report an issue: GitHub.
Appendix: source
Thrown at client/internal/acl/manager.go:442
addr, err := netip.ParseAddr(r.PeerIP)
if err != nil {
return netip.Addr{}, fmt.Errorf("invalid IP address, skipping firewall rule")
}
return addr.Unmap(), nil
}
func convertToFirewallProtocol(protocol mgmProto.RuleProtocol) (firewall.Protocol, error) {
switch protocol {
case mgmProto.RuleProtocol_TCP:
return firewall.ProtocolTCP, nil
case mgmProto.RuleProtocol_UDP:
return firewall.ProtocolUDP, nil
case mgmProto.RuleProtocol_ICMP:
return firewall.ProtocolICMP, nil
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)
}
}
View on GitHub (pinned to 93e97f4bf1)