router-for-me/CLIProxyAPI · error
configure Codex live remote TCP proxy: %w
Error message
configure Codex live remote TCP proxy: %w
What it means
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.
Source
Thrown at internal/client/codex/live/media.go:269
webrtc.WithSettingEngine(settingEngine),
), nil
}
func isPublicRemoteIP(ip net.IP) bool {
return ip != nil && !ip.IsUnspecified() && !ip.IsLoopback() && !ip.IsPrivate() &&
!ip.IsLinkLocalUnicast() && !ip.IsLinkLocalMulticast() && !ip.IsMulticast()
}
func (r *pionMediaRelay) NewSession(ctx context.Context, clientOffer string, route mediaSessionRoute) (mediaRelaySession, string, error) {
if r == nil || r.downstreamAPI == nil || r.upstreamAPI == nil || r.proxyUpstreamAPI == nil || r.limiter == nil {
return nil, "", errors.New("Codex live media relay unavailable")
}
if errContext := ctx.Err(); errContext != nil {
return nil, "", errContext
}
builtProxyDialer, proxyMode, errProxy := proxyutil.BuildDialer(route.proxyURL)
if errProxy != nil {
return nil, "", fmt.Errorf("configure Codex live remote TCP proxy: %w", errProxy)
}
proxied := proxyMode == proxyutil.ModeProxy
var proxyDialer proxy.ContextDialer
if proxied {
contextDialer, ok := builtProxyDialer.(proxy.ContextDialer)
if !ok {
return nil, "", errors.New("Codex live remote TCP proxy does not support cancellation")
}
proxyDialer = contextDialer
}
if !r.limiter.acquire() {
return nil, "", errors.New("Codex live media relay capacity exhausted")
}
releaseSlot := r.limiter.release
downstream, errDownstream := r.downstreamAPI.NewPeerConnection(r.configuration)
if errDownstream != nil {
releaseSlot()
return nil, "", fmt.Errorf("create downstream PeerConnection: %w", errDownstream)View on GitHub (pinned to 78f0c4079e)
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
Example fix
# before proxy: http:proxy.corp.example.com:8080 # after proxy: http://proxy.corp.example.com:8080
Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(route.proxyURL) != "" {
if _, mode, err := proxyutil.BuildDialer(route.proxyURL); err != nil || mode == proxyutil.ModeInvalid {
return fmt.Errorf("invalid proxy URL %q for codex live session", route.proxyURL)
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Codex live session field must contain valid JSON
- antigravity token exchange: execute request: %w
- execute request: %w
- fetch Claude OAuth %s: %w
- claude oauth tls: dial upstream: %w
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/473cee75058ed6d5.
Report an issue: GitHub.