openai/codex · error · io::Error

io::ErrorKind::InvalidData

io::ErrorKind::InvalidData

Error message

failed to parse remote control pairing response from `{}`: HTTP {status}, {}, body: {body_preview}, expires_at parse error: {err}

What it means

Response validation error in start_pairing: the pairing response body parsed, but the expires_at field could not be converted into the expected timestamp type. The message preserves the HTTP status, body preview, and the underlying parse error, indicating the remote service returned an unexpected datetime format or value.

Solutions

  1. Log the raw expires_at value and verify it against the pairing API contract (RFC3339 vs Unix seconds).
  2. Make the field leniently parsed or optional, treating unknown expiry as no expiry.
  3. Retry the pairing request in case of a transient malformed response.
Defensive patterns

Strategy: try-catch

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:124

                ))
            },
        )?;
        let StartRemoteControlPairingResponse {
            pairing_code,
            manual_pairing_code,
            server_id,
            environment_id,
            expires_at,
        } = pairing;
        if server_id != self.server_id || environment_id != self.environment_id {
            return Err(io::Error::other(format!(
                "remote control pairing returned mismatched enrollment: expected server_id={}, environment_id={}; got server_id={}, environment_id={}",
                self.server_id, self.environment_id, server_id, environment_id
            )));
        }
        let expires_at = OffsetDateTime::parse(&expires_at, &Rfc3339)
            .map_err(|err| {
                io::Error::new(
                    ErrorKind::InvalidData,
                    format!(
                        "failed to parse remote control pairing response from `{}`: HTTP {status}, {}, body: {body_preview}, expires_at parse error: {err}",
                        self.remote_control_target.pair_url,
                        format_headers(&headers)
                    ),
                )
            })?
            .unix_timestamp();

        Ok(RemoteControlPairingStartResponse {
            pairing_code,
            manual_pairing_code,
            environment_id,
            expires_at,
        })
    }

View on GitHub (pinned to 339751715c)