{"record":{"id":"473cee75058ed6d5","repo":"router-for-me/CLIProxyAPI","slug":"configure-codex-live-remote-tcp-proxy-w","errorCode":null,"errorMessage":"configure Codex live remote TCP proxy: %w","messagePattern":"configure Codex live remote TCP proxy: %w","errorType":"http","errorClass":null,"httpStatus":502,"severity":"error","filePath":"internal/client/codex/live/media.go","lineNumber":269,"sourceCode":"\t\twebrtc.WithSettingEngine(settingEngine),\n\t), nil\n}\n\nfunc isPublicRemoteIP(ip net.IP) bool {\n\treturn ip != nil && !ip.IsUnspecified() && !ip.IsLoopback() && !ip.IsPrivate() &&\n\t\t!ip.IsLinkLocalUnicast() && !ip.IsLinkLocalMulticast() && !ip.IsMulticast()\n}\n\nfunc (r *pionMediaRelay) NewSession(ctx context.Context, clientOffer string, route mediaSessionRoute) (mediaRelaySession, string, error) {\n\tif r == nil || r.downstreamAPI == nil || r.upstreamAPI == nil || r.proxyUpstreamAPI == nil || r.limiter == nil {\n\t\treturn nil, \"\", errors.New(\"Codex live media relay unavailable\")\n\t}\n\tif errContext := ctx.Err(); errContext != nil {\n\t\treturn nil, \"\", errContext\n\t}\n\tbuiltProxyDialer, proxyMode, errProxy := proxyutil.BuildDialer(route.proxyURL)\n\tif errProxy != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"configure Codex live remote TCP proxy: %w\", errProxy)\n\t}\n\tproxied := proxyMode == proxyutil.ModeProxy\n\tvar proxyDialer proxy.ContextDialer\n\tif proxied {\n\t\tcontextDialer, ok := builtProxyDialer.(proxy.ContextDialer)\n\t\tif !ok {\n\t\t\treturn nil, \"\", errors.New(\"Codex live remote TCP proxy does not support cancellation\")\n\t\t}\n\t\tproxyDialer = contextDialer\n\t}\n\tif !r.limiter.acquire() {\n\t\treturn nil, \"\", errors.New(\"Codex live media relay capacity exhausted\")\n\t}\n\treleaseSlot := r.limiter.release\n\tdownstream, errDownstream := r.downstreamAPI.NewPeerConnection(r.configuration)\n\tif errDownstream != nil {\n\t\treleaseSlot()\n\t\treturn nil, \"\", fmt.Errorf(\"create downstream PeerConnection: %w\", errDownstream)","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/client/codex/live/media.go#L251-L287","documentation":"Thrown when proxyutil.BuildDialer cannot turn the route's proxy URL into a dialer for the upstream (OpenAI) WebRTC connection. BuildDialer returns ModeInvalid plus an error for malformed or unsupported proxy URLs (anything not http/https/socks5/socks5h, unparsable URLs, invalid ports). It occurs before any PeerConnection exists, so nothing to clean up yet.","triggerScenarios":"mediaSessionRoute.proxyURL is a string like 'bad-value', a URL with an unsupported scheme (e.g. 'quic://...'), or fails url.Parse — the per-request proxy setting resolved from auth/config for the Codex live session.","commonSituations":"A typo'd proxy URL in auth metadata or config (missing '//' in 'http:proxy:8080'), a scheme the proxyutil package does not support, or an empty-but-whitespace URL mishandled by the resolver.","solutions":["Correct the proxy URL to a full form: scheme://host:port with scheme in http, https, socks5, or socks5h","Remove the proxy setting for this route if direct connectivity is intended (ModeDirect needs no URL)","Trace where mediaSessionRoute.proxyURL is populated and validate it earlier with proxyutil.BuildDialer at config/auth load time"],"exampleFix":"# before\nproxy: http:proxy.corp.example.com:8080\n\n# after\nproxy: http://proxy.corp.example.com:8080","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(route.proxyURL) != \"\" {\n\tif _, mode, err := proxyutil.BuildDialer(route.proxyURL); err != nil || mode == proxyutil.ModeInvalid {\n\t\treturn fmt.Errorf(\"invalid proxy URL %q for codex live session\", route.proxyURL)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate proxy URLs with proxyutil.BuildDialer at auth/config load time","Use full scheme://host:port forms only","Restrict accepted schemes to http, https, socks5, socks5h"],"tags":["proxy","configuration","network","validation"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}