{"record":{"id":"3a3ec96c64134483","repo":"openai/codex","slug":"invalid-mcp-oauth-callback-port-config-port-p","errorCode":null,"errorMessage":"invalid MCP OAuth callback port `{config_port}`: port must be between 1 and 65535","messagePattern":"invalid MCP OAuth callback port `(.+?)`: port must be between 1 and 65535","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rmcp-client/src/perform_oauth_login.rs","lineNumber":415,"sourceCode":"\nstruct OauthLoginFlow {\n    auth_url: String,\n    oauth_state: OAuthState,\n    authorization_server_issuer: Option<String>,\n    rx: oneshot::Receiver<CallbackResult>,\n    guard: CallbackServerGuard,\n    server_name: String,\n    server_url: String,\n    store_mode: OAuthCredentialsStoreMode,\n    keyring_backend_kind: AuthKeyringBackendKind,\n    launch_browser: bool,\n    timeout: Duration,\n}\n\nfn resolve_callback_port(callback_port: Option<u16>) -> Result<Option<u16>> {\n    if let Some(config_port) = callback_port {\n        if config_port == 0 {\n            bail!(\n                \"invalid MCP OAuth callback port `{config_port}`: port must be between 1 and 65535\"\n            );\n        }\n        return Ok(Some(config_port));\n    }\n\n    Ok(None)\n}\n\nfn local_redirect_uri(server: &Server) -> Result<String> {\n    match server.server_addr() {\n        tiny_http::ListenAddr::IP(std::net::SocketAddr::V4(addr)) => {\n            let ip = addr.ip();\n            let port = addr.port();\n            Ok(format!(\"http://{ip}:{port}/callback\"))\n        }\n        tiny_http::ListenAddr::IP(std::net::SocketAddr::V6(addr)) => {\n            let ip = addr.ip();","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rmcp-client/src/perform_oauth_login.rs#L397-L433","documentation":"Error \"invalid MCP OAuth callback port `{config_port}`: port must be between 1 and 65535\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:415 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}