router-for-me/CLIProxyAPI · error
codex.live-media-relay.ice-servers[%d] contains an invalid U
Error message
codex.live-media-relay.ice-servers[%d] contains an invalid URL
What it means
Each ICE server URL must parse with net/url and carry a scheme. This error fires when url.Parse fails or the scheme is empty — the URL is structurally broken (control characters, missing scheme separator, or just a bare host).
Source
Thrown at internal/config/codex_live.go:96
}
if c.UDPPortMin > c.UDPPortMax {
return errors.New("codex.live-media-relay.udp-port-min must not exceed udp-port-max")
}
if c.UDPPortMin != 0 {
availablePorts := int(c.UDPPortMax) - int(c.UDPPortMin) + 1
requiredPorts := c.EffectiveMaxSessions() * 2
if availablePorts < requiredPorts {
return fmt.Errorf("codex.live-media-relay UDP range requires at least %d ports for %d sessions", requiredPorts, c.EffectiveMaxSessions())
}
}
for serverIndex, server := range c.ICEServers {
if len(server.URLs) == 0 {
return fmt.Errorf("codex.live-media-relay.ice-servers[%d].urls is required", serverIndex)
}
for _, rawURL := range server.URLs {
parsed, errParse := url.Parse(strings.TrimSpace(rawURL))
if errParse != nil || parsed.Scheme == "" {
return fmt.Errorf("codex.live-media-relay.ice-servers[%d] contains an invalid URL", serverIndex)
}
switch strings.ToLower(parsed.Scheme) {
case "stun", "stuns", "turn", "turns":
default:
return fmt.Errorf("codex.live-media-relay.ice-servers[%d] uses unsupported scheme %q", serverIndex, parsed.Scheme)
}
}
}
return nil
}
View on GitHub (pinned to 78f0c4079e)
Solutions
- Write full URLs with scheme: 'stun:stun.l.google.com:19302', 'turn:host:3478?transport=udp', 'turns:host:5349?transport=tcp'.
- Trim stray whitespace/quotes around each URL in the config.
- Validate each URL with url.Parse in a pre-deploy lint if configs are generated.
Example fix
# before urls: - turn.example.com:3478 # after urls: - turn:turn.example.com:3478?transport=tcp
Defensive patterns
Strategy: validation
Validate before calling
for _, u := range server.URLs {
p, err := url.Parse(strings.TrimSpace(u))
if err != nil || p.Scheme == "" {
return fmt.Errorf("invalid ICE server URL %q", u)
}
} Type guard
func isValidICEServerURL(raw string) bool {
p, err := url.Parse(strings.TrimSpace(raw))
return err == nil && p.Scheme != ""
} Prevention
- Always include the scheme: 'stun:host:port', not 'host:port'.
- Quote URLs containing '?' in YAML to avoid parser surprises.
When it happens
Trigger: Validate iterates server.URLs; a raw URL like 'turn.example.com:3478' (no turn: scheme), 'stun://stun host' (space), or one containing characters net/url rejects.
Common situations: Omitting the scheme and writing host:port only; copy-paste adding a space or smart quote; using ':3478' style after scheme incorrectly.
Related errors
- codex.live-media-relay.ice-servers[%d].urls is required
- codex.live-media-relay.ice-servers[%d] uses unsupported sche
- codex.live-media-relay.public-ip is invalid: %q
- codex.live-media-relay UDP range requires at least %d ports
- invalid plugin store url
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/e2bda40a29639f10.
Report an issue: GitHub.