openai/codex · error · anyhow::Error
current-time response is outside the supported range
Error message
current-time response is outside the supported range
What it means
After a successful current-time request, the raw response value is converted with DateTime::from_timestamp(response.current_time_at, 0). When that returns None, the client's current_time_at field held a unix-seconds value outside chrono's supported DateTime range (e.g. garbage, milliseconds instead of seconds, or a corrupted payload), so no valid DateTime can be produced and the whole request_current_time call fails.
Solutions
- Validate that response.current_time_at is within a sane unix-seconds range before converting
- Log the raw current_time_at value on failure to diagnose whether the server sent seconds, milliseconds, or garbage
- Check the client implementation behind CurrentTimeReadResponse for units or serialization bugs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/app-server/src/current_time.rs:139 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/d942486b39308450.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/app-server/src/current_time.rs:139
"current-time request failed: code={} message={}",
err.code,
err.message
);
}
Ok(Err(err)) => bail!("current-time request was canceled: {err}"),
Err(_) => {
let _canceled = outgoing.cancel_request(&request_id).await;
bail!(
"current-time request timed out after {}s",
CURRENT_TIME_REQUEST_TIMEOUT.as_secs()
);
}
};
let response: CurrentTimeReadResponse =
serde_json::from_value(result).context("invalid current-time response")?;
DateTime::from_timestamp(response.current_time_at, 0)
.ok_or_else(|| anyhow!("current-time response is outside the supported range"))
}
fn require_single_current_time_connection(connection_ids: &[ConnectionId]) -> Result<ConnectionId> {
// External clocks are not interchangeable, so do not choose one silently.
match connection_ids {
[connection_id] => Ok(*connection_id),
_ => bail!(
"expected exactly one client subscribed to the thread, found {}",
connection_ids.len()
),
}
}
#[cfg(test)]
mod tests {
use super::require_single_current_time_connection;
use crate::outgoing_message::ConnectionId;
View on GitHub (pinned to 339751715c)