openai/codex · error · io::Error

invalid remote control URL

Error message

invalid remote control URL `{remote_control_url}`; expected HTTPS URL for chatgpt.com or chatgpt-staging.com, or HTTP/HTTPS URL for localhost

What it means

Policy validation error from normalize_remote_control_base_url: the base URL parsed but failed the allow-list check. Only HTTPS URLs on chatgpt.com / chatgpt-staging.com (or subdomains) are accepted, plus HTTP/HTTPS loopback (localhost) URLs for local testing. Any other host or an http URL on a public host triggers this error, with the offending URL echoed.

Solutions

  1. Point the remote control URL at an allowed HTTPS host (chatgpt.com or chatgpt-staging.com domain)
  2. Use a loopback host (localhost / 127.0.0.1 / ::1) for local development over http
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/app-server-transport/src/transport/remote_control/protocol.rs:268 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/b57595954c15a11a. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/app-server-transport/src/transport/remote_control/protocol.rs:268

    Ok(RemoteControlTarget {
        websocket_url: websocket_url.to_string(),
        enroll_url: enroll_url.to_string(),
        refresh_url: refresh_url.to_string(),
        pair_url: pair_url.to_string(),
        pair_status_url: pair_status_url.to_string(),
    })
}

pub(super) fn normalize_remote_control_base_url(remote_control_url: &str) -> io::Result<Url> {
    let map_url_parse_error = |err: url::ParseError| -> io::Error {
        io::Error::new(
            ErrorKind::InvalidInput,
            format!("invalid remote control URL `{remote_control_url}`: {err}"),
        )
    };
    let map_scheme_error = |_: ()| -> io::Error {
        io::Error::new(
            ErrorKind::InvalidInput,
            format!(
                "invalid remote control URL `{remote_control_url}`; expected HTTPS URL for chatgpt.com or chatgpt-staging.com, or HTTP/HTTPS URL for localhost"
            ),
        )
    };

    let mut remote_control_url = Url::parse(remote_control_url).map_err(map_url_parse_error)?;
    if !remote_control_url.path().ends_with('/') {
        let normalized_path = format!("{}/", remote_control_url.path());
        remote_control_url.set_path(&normalized_path);
    }

    let host = remote_control_url.host();
    match remote_control_url.scheme() {
        "https" if is_localhost(&host) || is_allowed_remote_control_chatgpt_host(&host) => {}
        "http" if is_localhost(&host) => {}
        _ => return Err(map_scheme_error(())),

View on GitHub (pinned to 339751715c)