snail007/goproxy · error
unkown parent type %s
Error message
unkown parent type %s
What it means
The UDP service callback dispatches packets to a parent based on cfg.ParentType. This error is the switch default branch: the configured ParentType is none of the supported values, so the packet cannot be forwarded and the failure is logged (the packet is dropped).
Source
Thrown at services/udp.go:80
func (s *UDP) Clean() {
s.StopService()
}
func (s *UDP) callback(packet []byte, localAddr, srcAddr *net.UDPAddr) {
defer func() {
if err := recover(); err != nil {
log.Printf("udp conn handler crashed with err : %s \nstack: %s", err, string(debug.Stack()))
}
}()
var err error
switch *s.cfg.ParentType {
case TYPE_TCP:
fallthrough
case TYPE_TLS:
err = s.OutToTCP(packet, localAddr, srcAddr)
case TYPE_UDP:
err = s.OutToUDP(packet, localAddr, srcAddr)
default:
err = fmt.Errorf("unkown parent type %s", *s.cfg.ParentType)
}
if err != nil {
log.Printf("connect to %s parent %s fail, ERR:%s", *s.cfg.ParentType, *s.cfg.Parent, err)
}
}
func (s *UDP) GetConn(connKey string) (conn net.Conn, isNew bool, err error) {
isNew = !s.p.Has(connKey)
var _conn interface{}
if isNew {
_conn, err = s.outPool.Pool.Get()
if err != nil {
return nil, false, err
}
s.p.Set(connKey, _conn)
} else {
_conn, _ = s.p.Get(connKey)
}
conn = _conn.(net.Conn)View on GitHub (pinned to e6d6a821db)
Solutions
- Set the parent type to a supported value (tcp, tls, udp) in the UDP service config
- Normalize case/whitespace in the config value
- Upgrade the binary if you intend to use a parent type this build does not support
- Check the log line 'connect to %s parent %s fail' to see the offending value and correct it
Example fix
// before // parent_type=UDP // after // parent_type=udp
Defensive patterns
Strategy: validation
Validate before calling
pt := strings.ToLower(strings.TrimSpace(cfg.ParentType))
if pt != "tcp" && pt != "tls" && pt != "udp" {
return fmt.Errorf("udp service parent_type %q must be tcp|tls|udp", cfg.ParentType)
} Try / catch
if err := svc.Start(); err != nil {
if strings.Contains(err.Error(), "unkown parent type") {
log.Fatalf("udp parent_type invalid: %q; set tcp|tls|udp", cfg.ParentType)
}
} Prevention
- Set parent_type explicitly for UDP services; do not rely on defaults
- Validate enum config values in CI before deploying
- Use consistent lowercase values across all service configs
- Re-check config after migrating between versions that support different parent types
When it happens
Trigger: *s.cfg.ParentType is not TYPE_TCP, TYPE_TLS, or TYPE_UDP — blank config value, typo, or unsupported mode — so callback's default case returns "unkown parent type %s".
Common situations: Missing udp_parent_type/parent_type setting; value written as 'TCP'/'Tls' with wrong case; config migrated from a build supporting extra parent types (e.g. kcp) not enabled in this binary.
Related errors
AI-assisted analysis of snail007/goproxy@e6d6a821db (2026-09-03).
Data as JSON: /api/errors/27dd299f34d152e1.
Report an issue: GitHub.