{"record":{"id":"27dd299f34d152e1","repo":"snail007/goproxy","slug":"unkown-parent-type-s-27dd29","errorCode":null,"errorMessage":"unkown parent type %s","messagePattern":"unkown parent type (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/udp.go","lineNumber":80,"sourceCode":"func (s *UDP) Clean() {\n\ts.StopService()\n}\nfunc (s *UDP) callback(packet []byte, localAddr, srcAddr *net.UDPAddr) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Printf(\"udp conn handler crashed with err : %s \\nstack: %s\", err, string(debug.Stack()))\n\t\t}\n\t}()\n\tvar err error\n\tswitch *s.cfg.ParentType {\n\tcase TYPE_TCP:\n\t\tfallthrough\n\tcase TYPE_TLS:\n\t\terr = s.OutToTCP(packet, localAddr, srcAddr)\n\tcase TYPE_UDP:\n\t\terr = s.OutToUDP(packet, localAddr, srcAddr)\n\tdefault:\n\t\terr = fmt.Errorf(\"unkown parent type %s\", *s.cfg.ParentType)\n\t}\n\tif err != nil {\n\t\tlog.Printf(\"connect to %s parent %s fail, ERR:%s\", *s.cfg.ParentType, *s.cfg.Parent, err)\n\t}\n}\nfunc (s *UDP) GetConn(connKey string) (conn net.Conn, isNew bool, err error) {\n\tisNew = !s.p.Has(connKey)\n\tvar _conn interface{}\n\tif isNew {\n\t\t_conn, err = s.outPool.Pool.Get()\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\ts.p.Set(connKey, _conn)\n\t} else {\n\t\t_conn, _ = s.p.Get(connKey)\n\t}\n\tconn = _conn.(net.Conn)","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/snail007/goproxy/blob/e6d6a821db80e7f47ee6e981a144984e1d4ddb3d/services/udp.go#L62-L98","documentation":"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).","triggerScenarios":"*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\".","commonSituations":"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.","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"],"exampleFix":"// before\n// parent_type=UDP\n// after\n// parent_type=udp","handlingStrategy":"validation","validationCode":"pt := strings.ToLower(strings.TrimSpace(cfg.ParentType))\nif pt != \"tcp\" && pt != \"tls\" && pt != \"udp\" {\n    return fmt.Errorf(\"udp service parent_type %q must be tcp|tls|udp\", cfg.ParentType)\n}","typeGuard":null,"tryCatchPattern":"if err := svc.Start(); err != nil {\n    if strings.Contains(err.Error(), \"unkown parent type\") {\n        log.Fatalf(\"udp parent_type invalid: %q; set tcp|tls|udp\", cfg.ParentType)\n    }\n}","preventionTips":["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"],"tags":["configuration","udp","parent-type"],"backgroundTag":"unknown-parent-type","analyzedSha":"e6d6a821db80e7f47ee6e981a144984e1d4ddb3d","analyzedAt":"2026-09-03T15:32:42.750Z","contentChangedAt":"2026-09-03T15:32:42.750Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}