openai/codex · error · anyhow::Error
unable to determine callback address
Error message
unable to determine callback address
What it means
Raised in local_redirect_uri: tiny_http's listen address is neither an IPv4 nor IPv6 socket address (e.g. a Unix socket variant), so a loopback http redirect URI cannot be constructed for the OAuth callback. This is a guard against unsupported listener types on non-Windows platforms.
Solutions
- Start the callback server bound to an IP (loopback) address rather than a Unix socket
- Ensure the callback server configuration yields a TCP listener
- Use the platform-appropriate listener type for OAuth callbacks
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:438 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/51bdf5ca4ce692c2.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:438
}
Ok(None)
}
fn local_redirect_uri(server: &Server) -> Result<String> {
match server.server_addr() {
tiny_http::ListenAddr::IP(std::net::SocketAddr::V4(addr)) => {
let ip = addr.ip();
let port = addr.port();
Ok(format!("http://{ip}:{port}/callback"))
}
tiny_http::ListenAddr::IP(std::net::SocketAddr::V6(addr)) => {
let ip = addr.ip();
let port = addr.port();
Ok(format!("http://[{ip}]:{port}/callback"))
}
#[cfg(not(target_os = "windows"))]
_ => Err(anyhow!("unable to determine callback address")),
}
}
fn resolve_redirect_uri(server: &Server, callback_url: Option<&str>) -> Result<String> {
let Some(callback_url) = callback_url else {
return local_redirect_uri(server);
};
Url::parse(callback_url)
.with_context(|| format!("invalid MCP OAuth callback URL `{callback_url}`"))?;
Ok(callback_url.to_string())
}
fn callback_id_from_server_url(server_url: &str) -> Result<String> {
// Native Codex callback IDs intentionally hash the complete MCP URL (minus its fragment)
// with SHA-256. Python connector callback IDs use SHAKE-256 over the origin and are distinct.
let mut parsed =
Url::parse(server_url).with_context(|| format!("invalid MCP server URL `{server_url}`"))?;
parsedView on GitHub (pinned to 339751715c)