{"record":{"id":"7bc85168846818b0","repo":"cloudflare/cloudflared","slug":"v-is-not-valid-ip","errorCode":null,"errorMessage":"%v is not valid IP","messagePattern":"(.+?) is not valid IP","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tunnelrpc/pogs/session_manager.go","lineNumber":57,"sourceCode":"func (i SessionManager_PogsImpl) registerUdpSession(p proto.SessionManager_registerUdpSession) error {\n\tserver.Ack(p.Options)\n\n\tsessionIDRaw, err := p.Params.SessionId()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsessionID, err := uuid.FromBytes(sessionIDRaw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdstIPRaw, err := p.Params.DstIp()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdstIP := net.IP(dstIPRaw)\n\tif dstIP == nil {\n\t\treturn fmt.Errorf(\"%v is not valid IP\", dstIPRaw)\n\t}\n\tdstPort := p.Params.DstPort()\n\n\tcloseIdleAfterHint := time.Duration(p.Params.CloseAfterIdleHint())\n\n\ttraceContext, err := p.Params.TraceContext()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, registrationErr := i.impl.RegisterUdpSession(p.Ctx, sessionID, dstIP, dstPort, closeIdleAfterHint, traceContext)\n\tif registrationErr != nil {\n\t\t// Make sure to assign a response even if one is not returned from register\n\t\tif resp == nil {\n\t\t\tresp = &RegisterUdpSessionResponse{}\n\t\t}\n\t\tresp.Err = registrationErr\n\t}","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/tunnelrpc/pogs/session_manager.go#L39-L75","documentation":"registerUdpSession read the destination IP bytes from the RegisterUdpSession RPC parameters and net.IP(dstIPRaw) came back nil, meaning the bytes are not a valid 4- or 16-byte IP representation. cloudflared cannot route a UDP session without a valid destination address, so it rejects the registration.","triggerScenarios":"A RegisterUdpSession RPC arrives whose Params carry a DstIp byte slice that is empty, wrong length, or malformed — i.e., not parseable as an IPv4/IPv6 address.","commonSituations":"Client-side bug sending uninitialized/garbage IP bytes; QUIC packet marshalled by an incompatible cloudflared version; corrupted RPC payload over the wire.","solutions":["Fix the caller to send a valid dst IP (net.ParseIP(...).To4()/.To16()) in RegisterUdpSessionParams.","Update cloudflared on both ends to matching versions to avoid payload skew.","Validate the destination before dialing (net.ParseIP on the configured host)."],"exampleFix":"// before\nparams := quicpogs.RegisterUdpSessionParams{DstIp: []byte(\"invalid\")}\n// after\nip := net.ParseIP(\"198.51.100.7\")\nparams := quicpogs.RegisterUdpSessionParams{DstIp: ip.To4()}","handlingStrategy":"validation","validationCode":"ip := net.ParseIP(host)\nif ip == nil {\n    return fmt.Errorf(\"destination %q is not a valid IP\", host)\n}\nparams.DstIp = ip.To4()\nif params.DstIp == nil { params.DstIp = ip.To16() }","typeGuard":"func isValidDstIP(raw []byte) bool {\n    return net.IP(raw) != nil && (len(raw) == 4 || len(raw) == 16)\n}","tryCatchPattern":null,"preventionTips":["Always run destinations through net.ParseIP before populating RegisterUdpSessionParams","Use ip.To4()/To16() to get canonical byte slices","Keep client and server cloudflared versions aligned"],"tags":["udp","ip-validation","rpc"],"backgroundTag":"invalid-ip-address","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}